Leaving is a skill and almost nobody is taught it. There is a point at a party, or in a phone call, or halfway down a comment thread, where the thing has clearly turned, and the usual response is to stay another forty minutes hoping it improves.
It rarely improves. The cost of going is a small awkwardness at the door; the cost of staying is the rest of the evening and often the next morning too. Getting your coat early is not rudeness or avoidance. It is arithmetic, done in time to be useful.