I think we all struggle with this. The situations are never cut and dried, so a template is useless. But we can learn from each other. We can learn through experience. It may not be fun, but it is possible.
I find that reading body language gives me mixed results. Is someone mad at me or restless when they have their arms crossed? Are they laughing with me or at me? Did it suddenly go quiet? Was it something I said or did?
Here’s what I have learned. Stop thinking YOU did something. It sets off a negative cycle that can end up in a really awkward place. Instead, move the conversation forward or excuse yourself (oh, hey, I see Frank over there!). Don’t dwell on it. There’s plenty of time while you are trying to fall asleep.