Why is it that after listening to some songs several times you just can't remember the key and it's always out of tune?

One possible reason is that the music actually contains several layers of melody: they are synthesized by several different instruments or by electric ****. However, the average person can only sing one of these melodies at a time, and can't express the harmonies of all of them at the same time. And it's not just that you can only sing one melody at a time; when you try to vocalize it, your brain chooses between the different melodies by recalling them, resulting in what you end up humming is not even one of them, but a random combination of fragments between them.