People usually refer to this as the "age of accountability" and while you won't find those words in the Bible, the idea that children are treated differently from adults is found in various passages throughout the Scriptures.
The first occurs when the people of Israel rebelled against God and refused to enter the Promised Land. God told them that all adults aged 20 years and over would die in the wilderness and never enter the Promised Land. This distinction in age popularized the idea that there exists in the heart of God a time when every person becomes accountable for their sin and before which they are not culpable for their actions.
Another reference which occurs within the prophecies of Isaiah seems to support this same idea of an age of accountability. It describes childhood as a time "...before [the child] knows enough to reject the wrong and choose the right..." (7:16 NIV84)
Both passages cited above hint at the idea of an age of accountability, but, I want to emphasize, there is nothing in the Bible that specifically outlines when that accountability begins. Furthermore, there are no passages which specifically promise that a child who dies will be instantly granted entrance into heaven. Some would disagree citing the statement by Jesus in which He said, “Let the little children come to me and do not hinder them, for to such belongs the kingdom of heaven.” (Matthew 19:14 ESV) However, this is one of many passages where Jesus uses an analogy of a childlike heart to highlight what it takes to enter heaven. (See Matthew 18:2-3) He is not saying that heaven is literally populated by children.
So the comfort and confidence of knowing that a child is in heaven with God is not going to be fully satisfied by some proof-text of Scripture. Instead, this kind of confidence comes from knowing the character of God. To know God personally and intimately is to know with assurance that He can be trusted.
In such cases, I personally rely on the following facts about God:
1. God is love. (1 John 4:8) I know this statement may sound trite, but the implications remain our biggest reason for having hope in the midst of those things in life which seem horribly unfair and leave us with nothing but questions. When death visits a small child we can have the absolute confidence of knowing that God cares even more than we do about the passing of a small child. Furthermore, He is unhindered in His ability to express His love toward that child.
2. God can be trusted to do what is right. When Abraham was told that God was about to rain down judgment upon the cities of Sodom and Gomorrah (where his nephew Lot happened to be living), Abraham began to question God's mercy and forbearance. Finally, he posed this question to the Lord: "Will not the Judge of all the earth do right?" (Genesis 18:25) Abraham had confidence in the answer to that question, but sometimes I wonder if believers today possess that same confidence. God is the Judge of all the earth. Can we trust Him to make the absolute best decision in such matters? I believe we can, and that ought to fill us with hope.
For my part, I believe that upon death God accepts children into His presence without question, but not because I have a single passage of Scripture that I can point to. Instead, my confidence rests in the Person of God Himself — His faithfulness and mercy which I find nothing short of astounding.