There are no hard and fast rules to song writing and structure. However, music is all about patterns, therefore chords and melodies often lend themselves to patterns as well. These patterns may vary from song to song, but there are some fundamental things you can look out for that might help you with determining the key of a song…
If a progression has a dominant 7, then it’s a good chance it’s a V7. The root of the scale would be a 5th down.
Eg. D - Am - G7 - C
The dom7 (G7) is a 5th above the root note (C.) The key here is C Major
If there are 2 consecutive major chords, then the second one is most likely the V chord, which is a 5th above the tonic.
Eg. Am - C - F - G
Here F & G chords are conservative, next to each other. The G is actually the V, making the tonic C and the key C Major.
If you have two consecutive minors, then the second one is most likely a V chord from a minor scale.
Eg. Am - C - Em - Dm
Here Dm and Em are consecutive, just the other way around. So the higher one, Em, will most likely be the V chord of a minor key. Am in this case.
If you have a dominant 7 chord, but the root chord is a minor, then it is most likely derived from a harmonic minor or a jazz minor scale.
Eg. Am - Dm - C - E7
Here the key is most likely an A Harmonic Minor or A Jazz Minor.
This system also works with 7th and 9th chords. But nothing is guaranteed because sometimes songs modulate keys, which means they change to a new key. Sometimes people do chord substitution too so they replace a chord with one not native to the scale.
A classic example would be Dock of the Bay…
Eg. G - B7 - C - A (simplified version)
It’s predominantly in the key of G, but the Bm(7) had been replaced with a dominant chord instead (B7). B7 doesn’t operate as a V chord within this song.
Hope this is of use.