One of the biggest reasons that songs occur in different keys has to do with the instrument playing them or the instrument they were written on.
One very important one is the voice. Singers generally have a specific range that is strong for them and they will sound best singing in that range. Depending on the type of singer, high notes are important for creating the climax of the song (think Whitney Houston or Mariah Carey). We can also keep in mind the ranges that singers have where they transition between chest voice and head voice/falsetto.
Other instruments also have their specifics to keep in mind. The standard low note on a guitar is E, so many songs are written with that in mind. Stevie Wonder is blind, so many of his songs are in keys with lots of sharps/flats, as the black notes on the piano are easy to find, but when bands that I've played in cover Superstition, particularly bands with guitar and no keys, it is almost always played in E instead of Eb. This allows the guitar player to hit the riff with the lowest note in their register instead of having to shift the whole thing up an octave.
Songs that have lots of horns often are written in keys with lots of flats, as most common horns transpose in the flat direction, so it's significantly easier to play songs with lots of flats than lots of sharps.
Beyond the ease of play or the high/low end of instruments, there are also difference in tone when you play in different keys on different instruments. The different ranges of an instrument can create a sort of tension or relaxation as a result of the physics behind the instrument. A stringed instrument will often sound more restricted in higher registers, as the strings have a shorter length to vibrate in. Horns and woodwinds often sound much warmer in their lower registers and more sharp or shrill in higher registers.
Playing in different keys necessitates that higher registers be used on some instruments, so this effect will take place frequently for many instruments, regardless of the music the composer is creating.