When it happens to me it is typically wrong place and the wrong time. If I am at a party and I wander over to a group of friends, they may be caught up in a conversation I have no place in. I'll go talk to someone else and come back later.
When we have parties at my house, it is almost exclusively good friends, every now and then someone will bring a friend or two, which is fine. We do what we can to include them, if we like them. Now they'll be included in the party, that doesn't mean when three of us walk outside to talk about something they'll be included in that. We'll do this to people we like, just because it isn't something they need be involved in.
As far as people we don't like, we'll faux-include them, and then I'll make back handed compliments all night that some of my really good friends will pick up on, but the person won't.
If it is happening outside of a party situation and we like the person, it is usually just because we have no connection with them. We'll introduce ourselves and then go about our discussion, they're welcome to jump in if they'd like, and they'll be recognized if they had something valid to say.
I wrote a four word letter.