What's the difference between a possessive and a contraction, and how do we know if a word is one not the other?
Context. And it's instantaneous. There is no figuring out involved.
If you just say "Tom's friend" that tells me instantly that you're talking about a friend of Tom. You don't even need a complete sentence. However, in "Tom's a friend of mine" it can only be a contraction. Nothing else would make sense.