When it comes to legally binding agreements, certain people are always considered to lack the legal ability (or "capacity") to contract. As a legal matter, basically they are presumed not to know what they're doing. These people--legal minors and the mentally ill, for example--are placed into a special category. If they enter into a contract, the agreement is considered "voidable" by them (as the person who lacked capacity to enter the agreement in the first place). Voidable means that the person who lacked capacity to enter the contact can either end the contract or permit it to go ahead as agreed on. This protects the party who lacks capacity from being forced to go through with a deal that takes advantage of his or her lack of savvy.
Let's look at some situations in which a person might lack the legal capacity to enter into a legally binding contract.
Minors Have No Capacity to Contract
Minors (those under the age of 18, in most states) lack the capacity to make a contract. So a minor who signs a contract can either honor the deal or void the contract. There are a few exceptions, however. For example, in most states, a minor cannot void a contract for necessities like food, clothing, and lodging. Also, a minor can void a contract for lack of capacity only while still under the age of majority. In most states, if a minor turns 18 and hasn't done anything to void the contract, then the contract can no longer be voided.
A person who lacks mental capacity can void, or have a guardian void, most contracts (except contracts for necessities). In most states, the standard for mental capacity is whether the party understood the meaning and effect of the words comprising the contract or transaction. This is called the "cognitive" test. Some states use what's called the "affective" test: a contract can be voided if one party is unable to act in a reasonable manner and the other party has reason to know of the condition. And some states use a third measure, called the "motivational" test. Courts in these states measure capacity by the person's ability to judge whether or not to enter into the agreement. These tests may produce varying results when applied to mental conditions such as bipolar disorder.
Alcohol and Drugs
People who are intoxicated by drugs or alcohol are usually not considered to lack capacity to contract. Courts generally rule that those who are voluntarily intoxicated shouldn't be allowed to avoid their contractual obligations, but should instead have to take responsibility for the results of their self-induced altered state of mind. However, if a party is so far gone as to be unable to understand even the nature and consequences of the agreement, and the other (sober) party takes advantage of the person's condition, then the contract may be voidable by the inebriated party.