The Circle of 5ths
The above diagram is referred to as both the Circle of 5ths and Circle of 4ths. This diagram is best thought of as a musical solar system. Each note and position on the circle represents the names of all 12 major keys. The key of C at the top is the only musical key with no sharps or flats (all the white keys on a piano). Moving around the right of the Circle, the keys are laid out 5 notes (a fifth) apart and gain one sharp for each key. Conveniently, we can think of the Circle of 5ths like a clock face. This diagram also shows us what the key signature (which specific notes are sharp) looks like on a treble clef staff):
Key of C: C, D, E, F, G, A, B, C (zero sharps)
Key of G: G, A, B, C, D, E, F#, G (one sharp)
Key of D: D, E, F#, G, A, B, C#, D (two sharps)
Key of A: A, B, C#, D, E, F#, G#, A (three sharps)
Key of E: E, F#, G#, A, B, C#, D#, E (four sharps)
Key of B: B, C#, D#, E, F#, G#, A#, B (five sharps)
Key of F#: F#, G#, A#, B, C#, D#, E#*, F# (six sharps)
All of these major keys follow the major scale pattern:
(W=whole step, or skipping a note- H=half step, directly to the next note)
1 W 2 W 3 H 4 W 5 W 6 W 7 H 1
(Do W Re W Mi H Fa W Sol W La W Ti H Do)
Paraphrased: 2 Wholes and a 1/2, then 3 Wholes and a 1/2)
This pattern makes the major scales more and more complex and full of flats. The formula is nice to know but in reality the scales are memorized from heavy use and application.
*The reason for the crazy looking E# in the F# major scale is because of a concept in music theory that states that a scale must be comprised of different note names for each degree (or position in the scale). In F#, the 7th note (Ti) is E#, which is the same thing as a plain F, but because there is already an F note in the scale (F#), there needs to be an 'E' represented (E#).
Finally, the reason there are technically 13 keys listed is because F#/Gb are equally complex in both sharps and flats (6 sharps and 6 flats each). Because of this, the key is referred to as either sharp or flat (depending on the musician or composer's preference).
Though we could go every 5 notes to name every key in music as a key with sharps (not just halfway around), the left side of the circle is easier expressed in flat keys, and is referred to the Circle of 4ths. A walkthrough of the Circle of 4ths can be found here. Seeing keys like C# (7 sharps) isn't unheard of, but these keys usually are expressed by their less complex names (Db, which has 5 flats).
Where the Circle of 5ths/4ths is really useful is keeping in mind the common names and existence of all the major keys in music, as well as their complexity. Guitarists and bassists should work down the right side of the circle in Chordal charts. Pianists can work equally down both sides of the circle. Keys that are close together in the Circle are referred to as "closely related" and are often utilized in music that changes key.