People often make mistakes when drunk. Unfortunately for some, voluntary intoxication isn't a defense to or excuse for most criminal offenses.
In general, "voluntary intoxication" describes a situation in which someone drinks alcohol to excess or takes illegal drugs. The resulting intoxication is voluntary in that the defendant chose to consume the substances and had reason to know of their intoxicating effect. (For comparison, see Is Involuntary Intoxication a Defense?)
Legislators and courts have taken the attitude that, by and large, people must be accountable for their actions, regardless of whether they were operating with all their faculties. But courts will, on occasion, allow a defendant to present evidence of intoxication in order to disprove the mental state ("mens rea") required for an alleged offense.
States like California take the approach that defendants may use voluntary intoxication to argue that they didn't form the specific intent necessary to commit a particular crime. But it's a question of fact—someone can be drunk, but nevertheless capable of forming specific intent. Regardless, most crimes don't require specific intent, just general intent. And voluntary intoxication isn't a defense to general intent crimes in California and throughout most, if not all, of the country. (See General Intent Crimes vs. Specific Intent Crimes.)
Example 1: Joe and a group of friends are playing cards at his house, in Los Angeles. All of them are drinking beer, but Rob is drinking much more than others. Rob drinks so much that he has to retire from the card game in favor of snoozing on the couch. While the others are still playing, he gets up and goes to use the bathroom. Before getting drunk, Rob had intended to steal Joe's wallet if it he happened to see it laying around. On his way out of the bathroom—at this point drunk—Rob notices Joe's wallet on a banister. He mistakes the wallet for his own because he's drunk, so he picks it up. After being dropped off at home and waking up the following morning, he realizes that he has two wallets: his and Joe's. Rob isn't guilty of theft by larceny, a specific intent crime that requires that the defendant take someone else's property while intending to permanently deprive the owner of it. Although he specifically intended to permanently deprive Joe of the wallet at an earlier point in the evening, when he picked up that wallet, he didn't.
Example 2: At the same card game, Rob, still tremendously inebriated, becomes enraged that he is losing. He starts an argument with Joe, then punches him in the face. He has no memory of the confrontation or wanting to hit Joe. Regardless of his level of intoxication—even if it rendered him technically unconscious, Rob is probably guilty of assault. Assault is a general intent crime—all it requires is that the defendant intend the physical act in question. Theft by larceny, on the other hand, requires that the defendant not only act intentionally (in taking property), but also with a specific state of mind (to permanently deprive the owner possession).
Even where voluntary intoxication is a potential defense to specific intent crimes, it often reduces the defendant's culpability, rather than let him or her off the hook. For example, assume one person, extremely inebriated, attacks another. Drunkenness might have prevented the attacker from forming the specific intent necessary to commit assault with intent to cause great bodily harm. But it probably won't absolve the assailant of liability for the general intent crime of simple assault.
Some states take a particularly restrictive approach to defenses based on voluntary intoxication. In Alabama, for example, voluntary intoxication can disprove the mental state required for a specific intent offense only if it amounts to insanity. The intoxication must make the requisite mental state "impossible"—it must be so severe that the defendant is "incapable of consciousness that he is committing a crime; incapable of discriminating between right and wrong." (Hunt v. Comm'r, 666 F.3d 708 (11th Cir. 2012), Green v. State, 342 So.2d 419, 421 (Ala. Crim. App.1977).)
Even in states that don't require temporary insanity, defendants must typically be really drunk to be incapable of forming specific intent. What's more, in some states, voluntary intoxication isn't any kind of defense, even when the alleged crime requires specific intent. (Such states may carve out an exception for intoxication caused by certain prescribed substances; for more on the effect of prescriptions, see Is involuntary intoxication a defense?) (Carter v. State, 980 So. 2d 473 (Fla. 2008).)
If you've been accused of a crime you allegedly committed while intoxicated, consult an experienced criminal defense attorney. There are wrinkles in the law on intoxication, and they can vary from state to state. A knowledgeable lawyer can fully advise you of the applicable law and protect your rights.