What is fair use in the US? When would it be a successful defense to copyright infringement?
An affirmative defense
It need not be raised unless the plaintiff establishes that the defendant's activity would otherwise be infringing. When fair use is raised as a defense, the burden is on the defendant to prove the elements of fair use.
A four-factor balancing test
Here is the text of 17 USC 107:
Notwithstanding the provisions of sections 106 and 106A, the fair use of a copyrighted work, including such use by reproduction in copies or phonorecords or by any other means specified by that section, for purposes such as criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research, is not an infringement of copyright. In determining whether the use made of a work in any particular case is a fair use the factors to be considered shall include—
(1) the purpose and character of the use, including whether such use is of a commercial nature or is for nonprofit educational purposes;
(2) the nature of the copyrighted work;
(3) the amount and substantiality of the portion used in relation to the copyrighted work as a whole; and
(4) the effect of the use upon the potential market for or value of the copyrighted work.
The fact that a work is unpublished shall not itself bar a finding of fair use if such finding is made upon consideration of all the above factors.
"Congress meant §107 to restate the present judicial doctrine of fair use, not to change, narrow, or enlarge it in any way and intended that courts continue the common-law tradition of fair use adjudication." (Campbell, quoting from H. R. Rep. No. 94-1476).
Factor 1: Purpose and character of use
The statute explicitly lists several purposes which would weigh in favor of a finding of fair use: criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research. However, that list is only illustrative, not exhaustive. Commercial use weighs against fair use. Nonprofit use weighs in favor of fair use. Parody is another purpose which greatly affects the analysis, especially as it interacts with factor 4.
Factor 2: The nature of the copyrighted work
"[T]he scope of fair use is generally broader when the source of borrowed expression is a factual or historical work" (Campbell).
"[I]nformational works, such as news reports, that readily lend themselves to productive use by others, are less protected than creative works of entertainment." (Sony Corp. v. Universal City Studios, 464 U.S. 417 (1984))
Factor 3: Amount and substantiality of the portion used in relation to the copyrighted work as a whole
"The extent of permissible copying varies with the purpose and character of the use." (Campbell) For example, full reproduction of an entire work was allowed in Sony. However, in Harper & Row v. Nation Enterprises, 471 U.S. 539 (1985), taking just 300 words from a 7,500 word excerpt of President Ford's memoirs was not found to be fair use because it took the "heart of the book". The amount and substantiality of the taking is judged with respect to the original work. How much of the original was taken? "A taking may not be excused merely because it is insubstantial with respect to the infringing work. As Judge Learned Hand cogently remarked, 'no plagiarist can excuse the wrong by showing how much of his work he did not pirate.'" (Harper & Row)
Factor 4: Effect of the use upon the potential market for or value of the copyrighted work
If the use new work takes the place of the original, thereby decreasing its market or value, that weighs against a finding of fair use. However, parody or criticism, simply by decreasing the value of the work it is critical of, does not suffer the same fate. "The market for potential derivative uses includes only those that creators of original works would in general develop or license others to develop. [...] [T]he law recognizes no derivative market for critical works." (Campbell) Parody and criticism might decrease the value of the original, not by taking its place, but rather, by saying something negative about it. Protection of that type of speech is one of the goals of the fair use defense.
The four factors are not to be "treated in isolation, one from another." "All are to be explored, and the results weighed together, in light of the purposes of copyright." (Campbell)
However, the court recognizes that "[t]he central purpose of this investigation is to see, in Justice Story's words, whether the new work merely supersedes the objects of the original creation", "to what extent the new work is transformative". "[T]he more transformative the new work, the less will be the significance of other factors, like commercialism, that may weigh against a finding of fair use." (Campbell)
"The task is not to be simplified with bright-line rules, for the statute, like the doctrine it recognizes, calls for case-by-case analysis." (Campbell)
In general, it is not possible know ahead of time whether a fair use defense would be successful in a particular case.
Perhaps the best way to learn how the courts apply these four factors is to look at example cases. The US Copyright Office hosts a Fair Use Case Index that lets you browse by subject matter and jurisdiction. Stanford hosts a smaller collection of examples.