I think as you go along as a player you get a 'feel' for the sound of certain keys. I can normally tell a 'guitar' key from listening to it. Certain voicings give things away, like hearing the low E string, or a G chord. Practice transcribing and your ear will develop, or play along with the
radio or TV ads or whatever. Put yourself in a position where you need to use your ear like that, and it will develop. Do it enough and you will hear a song on the radio and know what it is they are playing