Generally, the prosecution has the burden of proving every element of a crime beyond a reasonable doubt. But while a defendant isn't required to prove innocence in order to avoid conviction, the prosecution also doesn't have to prove guilt to the point of absolute certainty. And despite the general rule that the prosecution bears the burden of proof, there are instances when the burden shifts to the defendant.
(For more on "beyond a reasonable doubt" and other issues of proof, see Legal Standards of Proof.)
The presumption of innocence requires the prosecution to prove its allegations against the defendant beyond a reasonable doubt as to every criminal element. The elements of the crime generally consist of two parts: the act involved and the mental state or intent required.
The prosecutor bears the burden of producing evidence that the defendant committed the crime. When the prosecution establishes a fact that tends to prove an element of a crime, the burden essentially switches to the accused—not necessarily to disprove the fact—but to raise a doubt about it. The defendant need not raise doubt about every fact that the prosecution tries to prove—creating enough doubt about any point that's crucial to a guilty verdict will suffice. Of course, the more convincing the fact is, the tougher the defendant's burden is.
For instance, suppose the prosecution shows that, when searching the defendant, the police found a watch that a jewelry store reported as stolen. In defense of a burglary charge, the defendant would probably have to give a plausible explanation for possessing the watch legally. By producing a receipt or testimony that the watch was a gift, the defendant would essentially shift the burden back to the prosecution.
In virtually every criminal case, the prosecution must also prove that the defendant had a particular intent—either specific or general intent—to commit the crime. In other words, we generally reserve punishment for those who are culpable and act with a guilty mind (as opposed to acts committed by accident).
An example of a specific intent crime is theft. Theft requires that a defendant intended to take an item and not return it. The intent to achieve a certain outcome makes it a "specific intent" crime. With a general intent crime, the prosecution needs to prove only that the defendant committed the act in question, not that he intended any particular outcome from the act. For example, simple assault and battery is a general intent crime, requiring that the defendant intended to hit someone or disregarded a clear risk of hitting someone.
Depending on the particular offense, the prosecution will need to produce evidence of the defendant's intent and the defendant must then poke holes in that evidence.
An accused may claim that certain circumstances constitute a complete defense to actions that would otherwise be criminal. These circumstances are called affirmative defenses. Whether and to what extent the defense must prove an affirmative defense depends on the jurisdiction and the defense.
The most well-known affirmative defense is self-defense. It generally entails the defendant acknowledging that she committed the alleged act, but arguing that it appeared to be necessary in order to defend herself from harm. An example is fighting off a mugger.
Some states may require defendants to prove self-defense by a "preponderance of the evidence," while others require them to simply raise a plausible basis for it, and the prosecution to disprove it beyond a reasonable doubt. (Preponderance of the evidence is the lowest evidentiary standard; it requires the party to prove that the fact in question is more likely than not to be true.)
Other affirmative defenses include duress, entrapment, insanity, and necessity. Again, whether the defendant carries the burden and what that burden entails depends on the defense and the jurisdiction. For instance, the defendant may have the responsibility of proving insanity by "clear and convincing evidence." (Clear and convincing evidence is a burden lying somewhere between preponderance of the evidence and beyond a reasonable doubt, requiring that the fact to be proved be highly probable or reasonably certain.)
Each state has its own rules and requirements related to evidence in a criminal proceeding. If you are facing criminal charges, you should consult an attorney who is experienced in the nuances and procedures in your state.