In my experience, in situations like the one you describe, the people who left you out of conversation were probably not intentionally doing so. They just get one a stream of conversation and go back and forth too quickly for some of us folks who cannot think of something to say that quickly (I have the same problem - one of the reasons I prefer 1:1 conversation.)
I would try again with one or both people (hopefully individually). Don't write them off and think they just don't like you. Try starting conversations with them again, or if you see them say hello or respond when they do, etc. In short, continue to be friendly.
As far as how to keep from getting left out of conversations...I don't know. Often times, I sit on the sidelines and listen in on conversations and try to continue to make occasional eye contact with the person who is talking. It is rude, even in a group, to make it clear that you find the conversation boring. If you must leave, make an excuse. The phone is a good one...have a call to take/make. Or excuse yourself to be off to a meeting or an errand, etc. Say "It's been nice chatting/meeting up/sitting with you." It is NOT a lie.
I don't enjoy group conversations much at all. If I want to talk more with someone from the group, I might contact them later and say, "I enjoyed seeing you the other day but didn't get a chance to chat with you as much as I'd like. Would you like to meet up for coffee/lunch?" and then plan a time, which will make it sound like a private thing. My aim is to steer conversations to 1:1 settings.