Modulation is a fancy word for key change -- switching from one key to another in a single piece of music. It is a common practice in composition (both classical and rock or pop) and can be used to a variety of effects. Modulation can be subtle and smooth or abrupt and startling. It can cast an eerie glow on a piece of music or completely change the mood and direction. The effect achieved, however subtle or abrupt, is largely dependent on the type of modulation used.
The most common type of modulation is called pivot chord modulation. In this type of modulation, the key changes based on a chord shared by both keys; the destination chord often has the same root note or quality as the original chord. This allows for a smooth, almost foreshadowed modulation. A good example of this is found in the last chorus of rock songs; this type of modulation is used there to an almost triumphant effect.
Another common type of modulation is pivot tone modulation. Similar to pivot chord, pivot tone modulation uses a common pitch to move from key to key. This type of modulation is also subtle, depending on the piece of music in which it is used. It can, however, be used to a startling effect if the two keys have few notes in common. In songs using pivot tone modulation, the common pitch is often sustained or repeated and used a bridge between the two keys.
The most abrupt kind of modulation is direct modulation. The name is exactly what is says it is: a direct modulation using no common note or chord to bridge the two keys. When used correctly, direct modulation is shocking and can easily change the song's mood. This type of modulation switches keys either at a phrase's end (phrase modulation) or at a point in the middle of the song (static modulation).