Songs usually stay in one key, one scale or set of notes that are in harmony with each other. The keys of A B C D E F and G, majors and minors, and all the sharps and flats, all have their own distinct flavour and character.
Sometimes, changing to another key during a song adds drama, feeling, magic. It can be a device that adds momentum, or mystery. A good key change can lift an ordinary song into the stratosphere.
Listen to some famous rock & pop key changes