The laws in most states presume that anyone who writes a will is mentally competent to do so -- unless or until someone proves otherwise. If you want to challenge a will by proving the testator lacked mental capacity, you'll most likely have an uphill battle. This isn't to say that it can’t be done, but the proceedings begin with the assumption that you're wrong.
If your best friend died and left everything to his alma mater, you typically can't contest his will. The laws in every state restrict who can challenge a will to those who have standing with the estate. To have standing, a contestant must have a legally-based financial stake in the outcome of probate, meaning you are in line to inherit if the decedent died intestate, i.e. without leaving a will. The only individuals who qualify for intestate succession are blood relatives. Beneficiaries can also challenge a will; however, beneficiaries are only those persons mentioned in a will. Therefore, if the decedent omitted you from his will entirely and you're not his relative, you can't challenge it.
Timing is also critical. Most states have statutes of limitation for will contests and they're relatively short. For example, in New Jersey, you have only 10 days after the death of the testator to file a caveat with probate court, which automatically sends the will to the superior court for litigation. In other states, you have a little longer. In Florida, you have at least 20 days, and under some circumstances, you may have as long as three months.
The presumption of mental capacity assumes only that a testator had an understanding of what he was doing at the time he wrote his will, not that he was competent in all other areas of life. If he created the will, then later lost his faculties, he's considered competent to have written it. The standard for mental competence to create a will is rather low. The testator would only have to understand that he was bequeathing his property, as well as his relationships with the people to whom he bequeathed it. If his memory has otherwise grown a little faulty, this isn't grounds for a will contest. However, if he suffered from dementia or another mental disorder, you'd have cause to file a contest.
Burden of Proof
The burden of proof in a will contest is on the individual who is contesting. Accessing the decedent's medical records is a good place to start, though they many not suffice as proof by themselves unless a physician diagnosed the decedent with Alzheimer's or a mental disorder before the date of the will. Lacking this type of proof, you might have to rely on the testimony of witnesses who could describe aberrant behavior on the part of the decedent at the time he wrote the will. If you can locate a previous will that includes terms much different from those in the one you want to contest, you can combine this with testimony to demonstrate how the testator has lost his faculties. The contents of letters, notes and even emails written by the testator around the time he created the will can also offer proof that he lacked mental capacity.
Because will contests are typically hard to win, and because the standard for capacity to write a will is so low, you might consider challenging the will on more than one grounds. For example, you can charge undue influence in addition to mental incompetence. Just because the testator was able to understand what he was doing when he wrote the will, it does not necessarily follow that he was cognizant enough to resist another beneficiary telling him how to do it.