The key is the 'center of gravity' of a piece or section of music, established by particular chord progressions, which identifies the tonic and/or tonic chord, i.e., the note and/or major or minor triad that is the focal point of a section and the final point of rest. A piece is said to be in such and such key when that key predominates throughout; and the tonic harmony of the key is always to be found at the close of the piece, unless it leads to some further passage or movement.
Short pieces may stay in a single key throughout. More elaborate pieces may establish the main key, then modulate to another key, or a series of keys, then back to the original key.
Some people say that each of the various keys has a character, or color, of its own. In the past, when irregular temperaments were used, key coloration was a fact because intervals, such as thirds and thirds, were different in the different keys. But in the modern system of equal temperament there is no basis for key coloration.
The roots of this system of keys, arranged around a pitch or set of pitches, can be heard in the harmonic series (see harmonics) in which all frequencies, however close together, are related to the fundamental. The system of keys can be seen as a rationalization of the harmonic series, in which pitches are arranged in such a way as to give a sense of rootedness. As an organizing principle, this allows composers to create and release tension by moving away from and back to the home key; this in turn enables the creation of longer structures, which are understood aurally by distance from or proximity to the home key.
See also key signature.