Key signatures are a type of musical notation that indicate which key the song is to be played in. But key signatures, despite the name, are not the same thing as key. Key signatures are simply notational devices; just as a note is the notational name for a pitch, key signatures are the notational names for keys.
It is what it says it is: a signature, a simple piece of information that tips you off to the physical form (the key) to be played. What does it mean to be "in the key of F", or "in the key of Bb"? It means that the composer based the composition on the scale of F (which has 1 flat in it), or the scale of Bb (which has 2 flats in it). Key signatures appear right after the clef (before the time signature) and show a sharp or flat on the line or space corresponding to the note to be altered.
Key signatures placed at the beginning of songs will carry through the entire song, unless other key signatures are noted after a double bar, canceling out the first. For instance, it's entirely possible to start a song in the key of F but end it in the key of E flat; it all depends on the key signatures and where they're placed throughout the song (a key signature can change at any point). Accidentals can also show up throughout a song and only once or twice flatten or sharpen a note that was not previously indicated; this cancels out the key signatures, as well, but only temporarily, for as long as the accidental lasts. Beginners just learning to read music often have a hard time with key signatures because the key itself is not expressly written, and it's sometimes difficult to remember what goes where. Key signatures with five flats or sharps have been known to terrorize new musicians -- how in the world, they think, are we supposed to remember all these note changes while we're playing the song? It's obviously possible, though, and there are some rules that can help beginners identify and remember the key as it relates to the key signatures, rules that go beyond rote memorization. If there is more than one flat, the key is the note on the second to last flat.
If there are any sharps at all, the key is a half step up from the last one noted. F major, a key frequently found in beginning sheet music, only has one flat (B), and C major has no sharps or flats at all. Key signatures, when viewed in light of these rules, are much easier for beginners to digest, ensuring that a proper knowledge of key signatures is on its way through the door.
One fact that most people don't realize is that sharps and flats always occur in the same order: The order of the flats is B, E, A, D, G, C, F. The order of the sharps is just the opposite -- F, C, G, D, A, E, B. So if there is one flat in the key signature, it is always B. If there are two flats in the key signature, they are always B and E. Three flats are always B, E, and A.
Four flats in a key signature spell the word BEAD. And so on. It's the same in sharps, too, except backward. If there is one sharp in a key signature, it is always F.
Two sharps in a key signature are always F and C. Three are F, C, and G. And so on. So once you have memorized the order of the flats, all you have to do is apply the rule mentioned earlier: the next to the last flat is the name of the key.
For example, if you have four flats in a key signature, they are Bb, Eb, Ab, Db. The last flat is D, so the next to the last flat is A. So the key is Ab. With sharps, just mentally go up 1/2 step from the last sharp, and that is the key. For example, if a key has 4 sharps, they are F#, C#, G#, D#. One-half step above D# is E, so the key is E.
So there you have it. Memorize the order of the flats and sharps and those two simple rules, and you'll be able to identify what major key any song is in quickly and easily.
A free lesson from Duane on key identification is available: "How To Tell What Key a Song Is In"