This is an excellent write-up about how fair use works, along with its complexities (and areas where it is more straightforward, generally where courts have already ruled on a very similar use previously):
If you kill someone, you’ve committed murder, right? Yes — unless he was about to shoot you first, in which case we call it self-defense. Fair use takes that same concept to copyright law. It is all about justification, and this is a key to understanding it. Fair use allows use of a work that would ordinarily constitute infringement, if that use is justified (or excused, if you like) with some compelling reason.