I make myself busy or scarce.
The most obvious time this happened was over the course of about 4 days. My son’s grandfather died a few years ago and I took my son to the funeral, about a 9 hour train ride away, but we had to stay at the house with my ex, my ex’s new girlfriend and my ex-mother in law. I brought a tent for me and little man to sleep in, so we didn’t take up room in the tiny apartment. It worked out really well. I was not welcome, as it turned out, (go figure) so I spent a great deal of time in the tent with a couple of beers and a book. My kid got to hang out with his cousins from Amsterdam and was really awesome source of love and support for his dad and his grandma, and I just hung out on the edge of it all.
At other events, I just find busy things to do. I’ll tidy things, or find jobs to do in the kitchen or hang out with the kids, if there are any. I’m very awkward in social situations anyway.