But in westren music there are twelve notes in each octave that are in common use. How do you name the other five notes (on a keyboard, the black keys)?
The sharps or flats always appear in the same order in all key signatures. This is the same order in which they are added as keys get sharper or flatter. For example, if a key (G major or E minor) has only one sharp, it will be F sharp, so F sharp is always the first sharp listed in a sharp key signature. The keys that have two sharps (D major and B minor) have F sharp and C sharp, so C sharp is always the second sharp in a key signature, and so on. The order of sharps is: F sharp, C sharp, G sharp, D sharp, A sharp, E sharp, B sharp. The order of flats is the reverse of the order of sharps: B flat, E flat, A flat, D flat, G flat, C flat, F flat. So the keys with only one flat (F major and D minor) have a B flat; the keys with two flats (B flat major and G minor) have B flat and E flat; and so on. The order of flats and sharps, like the order of the keys themselves, follows a circle of fifths.
If you do not know the name of the key of a piece of music, the key signature can help you find out. Assume for a moment that you are in a major key. If the key contains sharps, the name of the key is one half step higher than the last sharp in the key signature. If the key contains flats, the name of the key signature is the name of the second-to-last flat in the key signature.