Why are key changes used?
A less scrutinized use of direct modulation in a song is for the bridge. A sudden change to a new key helps make the bridge feel like an exciting launch into a new section, which is different than repeating yourself only slightly higher.
Why do key changes sound good?
Relaxation in energy would be the opposite direction, usually. Large changes in key signature (many accidentals changing) are more likely to give a sense that you've gone somewhere pretty far from where you were, and small changes seem nearer by.
What is changing key?
: a key that operates only one lock of a master-keyed lock system.