It took me a long time to learn how to be comfortable in social situations. I was probably around 25 before I got the hang of it. The thing I used to do is sit at the edge of groups and watch and listen how they would interact. I kind of studied how it all worked. And as time went on, I practiced little things I'd seen, and took it from there. Because each situation is different there's no easy formula, but it helps to have an idea what the other person likes doing, what things are going on in their life right now (nothing too personal though), and then base what you say around that.
The best trick I learned was to ask questions. Keep the focus on them. That way you don't have to think of much stuff to say, and they feel like you're interested in them. Try to look at their face a bit, even if not straight into their eyes, so they feel like you're listening. When I first started doing this, I'm wasn't necesarily listening to their answers too closely. But it would keep a conversation flowing. The rule with questions is don't ask anything super-personal, and try to follow on from the last things they said. Once you've done it a bit, it's not too hard. Practice makes perfect(ish)...