For questions about key signatures, scales, modes and similar topics. Most questions should also be tagged with "music-theory".
In Western music notation and parlance, a "key" is a series of notes on the staff which are, unless otherwise indicated, always to be played "sharp" or "flat" as the key may indicate. The indication in written music is a sequence of sharp or flat symbols at the left side of each staff, to the right of the clef symbol (and the time signature if there is one on that line) and to the left of the first note of the first measure of the line. The general purpose of a key is to make all notes of the scale based on the root note of this key conform to the note progression expected of the type of key being played.
Keys are closely tied into Western music theory, particularly the "Circle of Fifths". The basis of the circle is the key of C major, which has the same key signature as that of A minor (a "minor key" with a given key signature always has the sixth scale degree of the corresponding major key as its own tonic note). This key has no sharp or flat notes; it progresses through the normal lettered pitches, C-D-E-F-G-A-B-C. Now, within this key, a triad built on the root, third and fifth incorporates a major third followed by a minor third, giving the triad a "major" quality. The 4th and 5th scale degrees, F and G, when used as the root of a similar triad based on odd-numbered intervals from the root note within the key, are also major. All other chords formed this way within a major key have a minor quality, except the one formed from the seventh, which incorporates both "minor thirds" that are found within the major key, and forms a "diminished" triad.
Keys based on F and G are found adjacent to the key of C on the "Circle of Fifths". The Circle is so named because it is found by taking the fifth scale degree of each key in succession and building a new major key based on it (the fourth scale degree of a key, if the root is played above it, also forms a fifth). The key of G is the simplest "sharp" key, and makes the seventh scale degree, F, always sharp (otherwise the seventh scale degree would be a whole step from the tonic, forming the dominant, when in a major key it is a half-step from the tonic). Meanwhile, going in the opposite direction by fourths, the key of F, built on the fourth scale degree of C, is the simplest of the "flat keys", and makes one note, B (the fourth scale degree of F major), always flat, because the "natural" note would normally only be a half-step from the fifth of the key (C), while the "perfect fourth" is a whole step from the fifth.
This pattern continues, with the flat keys adding using the fourth of the previous key as the root of the next one, and adding a flat to the fourth scale degree of the new key along with all others (so except for F, the tonic notes of a "flat" key are all flat, as the flatted fourth of the previous key becomes the root of the next), while for sharp keys, the fifth of the previous key becomes the root of the new key, and the seventh scale degree is made sharp. The progression of flat major keys is F-Bb-Eb-Ab-Db-Gb-Cb, while for sharp keys it is G-D-A-E-B-F#-C#.
Now, notice that the last three flat keys have enharmonic tonic notes to the last three sharp keys. Cb is the same note as B, Gb is the same as F#, and Db is the same as C#. In fact, these three pairs of keys have all the same notes between each pair, and so are the same key simply written two different ways, either with sharps or flats. That reduces the total number of sonically different sharp or flat keys from 14 to 11, plus the key of C major giving us 12 total sonically unique key signatures, one for each of the 12 semitones of the Western pitch system, and each one representing both a major and a minor key depending on the given root note.