Finding the key of a song can come by two means:
1 is very practical and it requires the listener/player to know some theory. By understanding the structure of the chords and melody, you can easily determine the key center of any song.
The other means is somewhat intuitive...maybe inherent...and it requires the listener/player to be able to comprehend tension and resolution in music. This tension and resolution is a product of the structure of the chords and melody so understanding theory sure helps to understand why the tension and resolution is there but some folks, like me, can hear this stuff before we know what it is or why it is.
There's a common misconception that the first chord of a song coincides with the key of a song (for example; first chord is C major = key of C) and while this does happen from time to time, it's not a rule at all. Some songs start on the minor 6 chord, some on the 4 some on the 5 and some on the flat 2.
Some songs don't ever play the tonic (the root chord that coincides with the key) of the song and so the song doesn't ever sound like it resolves.
Stevie Wonder's "Ribbon in the Sky" doesn't play the tonic chord until the very end of the song. It's literally the LAST chord of the song.