The Circle of Fifths

If you start with the C scale, and go up to the 5th note, you end up on G. If you go up to the 5th note of the G scale, you get D. If you keep this up through all the keys, you end up on C again. This is called the circle of fifths, and can be represented as a line that repeats, or as a circle.
C G D A E B F#/Gb C#/Db G#/Ab D#/Eb A#/Bb F C G D A etc. C F G A#/Bb D D#/Eb A G#/Ab E C#/Db B F#/Gb
If you are playing a tune in the key of D, the chords which are most likely to be used in the tune are D, A (clockwise in the circle, or to the right in the line), and G (counter-clockwise in the circle, or to the left in the line). If you go to any other key, the same relative positions apply. For instance, in the key of B, the other two principal chords are F# and E, which are on either side of B in the circle or the line.
Another chord which is used in many tunes is the “relative minor”, which is always the minor chord of the note three positions clockwise in the circle, or three positions to the right in the line. Thus the relative minor of G is E minor; the relative minor of A is F#, etc.
In ragtime and some other musical styles, you often get a phrase where the chords move counter-clockwise around the circle of fifths. For instance, a tune in the key of C might end with A – D – G – C.
There is a simple way to describe these chord relationships regardless of what key you are in. Classical musicians talk about the “tonic” (the chord for the key you are in), the “dominant” (the next chord clockwise in the circle of fifths), and the “subdominant” (the next chord counterclockwise in the circle). Studio musicians and others who play popular music usually use a simpler vocabulary. They call the chord for the key you are in the “one” (Roman numeral I) chord. The clockwise or dominant chord is the “five” (Roman numeral V) chord, and the counter-clockwise chord or subdominant is the “four” (Roman numeral IV). The relative minor is the “six (Roman numeral VI) minor”. This makes sense if you think of the numbers as positions in the scale of the key you are in. The first note of the C scale is C, the fifth note is G, and the fourth note is F.
There are several advantages to the number system. You can talk about any note of any scale, and any chord in any key, by referring to its number, such as the II chord, the VI minor, etc. You can talk about the chords for a particular tune regardless of what key it’s in. You don’t have to worry about transposing into a different key to communicate with a guitar or banjo player who is using a capo. And you don’t have to learn a whole new vocabulary of exotic terms such as “mediant”, “supertonic”, “submediant”, “subtonic”, etc.