How do you figure out what key a song is in?

Probably a stupid question?
a song usually starts and ends on the chord of the key that its in, like if it starts on a G major chord then its in the key of G major, usually
Also, you can figure out the sharps and flats in the song, and use them to find out what scale it is.
"Insecticon" of the Predacons Beast Wars Club
PM NightmareXT To Join!

You make me feel
Like a dog, you can see, my emotions
Is this for real, i'm a man
Sinking deep, in the ocean