The Bible is silent on whether or not mentally ill people go to heaven. There is some biblical evidence, however, that anyone who is unable to make a decision for salvation is covered by Christ's death. This is similar to how it is commonly believed that when children die, they are automatically taken to heaven until they reach the age where they can make a decision for or against Christ. David had a child die, and he consoled himself by thinking, "Can I bring him back?" I'll go to him, but he won't come back" (2 Samuel 12:23). David knew he'd see his child again in heaven one day. We can infer from that statement that, by God's grace, Christ's death provided salvation for babies and young children.
We can assume that this principle also applies to mentally handicapped people. However, the Bible does not expressly state this. Knowing God's love, grace, and mercy, this would appear to be consistent with His character. Any person who is mentally challenged to the point where he cannot recognise his sinful state and believe in Christ for salvation is in the same category as a child, and it is not unreasonable to believe that person is saved by the same God who saves babies and small children.
However, we must be cautious not to become dogmatic about any issue that the Bible does not specifically address. We do know that Jesus accepts all that the Father has given to Him as His own, and He will not lose any of them along the way (John 6:39). "And I give to them eternal life, and they shall never perish, and no one shall pluck them out of My hand," Jesus said of these (John 10:28). We can find solace in the fact that our God's plan is always perfect, that He always does what is right and just, and that His love and mercy are infinite and eternal.