A male injecting himself into a group of girls and trying to join the conversation is often awkward. There is a fair chance that they are talking about "girl things" and you'll be seen as an outsider. You're better to look for a group that is mixed guys and girls so you're one of the guys instead of the only guy.
If you know a girl in the group, you can walk up and say something specifically to her, as if you wanted to tell her something and she just happened to be with a bunch of her friends at the time. Then if you're lucky maybe the others will continue a conversation and you can join in because you "just happen to be there".
As in any conversation, if it turns out that you're an unwelcome outsider, if someone explicitly says, "hey, you're not welcome here" -- whether that rudely or in some more subtle and polite way -- just say "oh, sorry" and leave. Don't try to argue about it: there's no way you're going to argue people into being your friends. Don't make a big long excuse: nobody cares, and by making excuses you just justify them being rude to you. Just make a quick "sorry" and walk away.
If no one tells you you're not welcome but it's apparent to you that you are, like if when you join the group suddenly everybody stops talking and is just looking around awkwardly, just say, "well, gotta go" or "nice meeting you all" or some such and leave. Again, don't drag it out into some long explanation, just one sentence and go.
If people are deliberately trying to be rude to you and hurt your feelings, than acting like you don't care and you aren't bothered ruins it for them. If they aren't trying to hurt your feelings but just feel awkward having you try to join this group where you don't fit, then acting like you don't care and aren't bothered makes it easier on everyone.
And -- this is a lot easier to say than to do -- don't let it bother you if a conversation goes badly. I'm sure we've all had times when a conversation gets awkward for whatever reason and we agonize over it and feel sick about it for days ... or years. But try to just not worry about it and move on.