Composers use modulation to add interest and drama to their works. Modulation is changing musical horses in midstream.
Specifically, it means leaving the key you are currently in, and going to a completely different key, without
stopping or pausing the music.
What different key do you go to? If you just went to any other key arbitrarily it could sound too unnatural. Composers often modulate to the dominant key, meaning the key of the 5 harmony. This is the simplest and smoothest kind of modulation; it doesn’t offend our sense of what is natural. Another common modulation is to the key of the 4 harmony. Yet another frequent kind of modulation is to just raise the key a half step or a whole step, such as A to B flat or A to B. Or lower it (as in the Four Seasons song Maryann).
How does music make the transition? When music modulates to the dominant key, very often it will “go through” 5 of 5 to get there. This is a relatively seamless way of doing it. The sequence is 1 -> 5 / 5 -> 5, and then what was 5 now becomes 1 in the new key. To modulate to the key of 4, composers will use 57 of 4 as an intermediary.
To modulate up a half step, music will just make the jump with no intermediary. To modulate up a whole step, you can just make the jump, or you can transition through 5 of 2, which is the dominant harmony to that new key.