Not to undermine the good advice people have already posted here, but HNers are going to approach these sorts of questions like an engineer. Social interaction like small talk is actually much closer to art than science(though both are involved), so it's a mistake to assume that there's a formula or framework that creates better smalltalk. That doesn't work because we never have even 10% control over the context and all the variables involved.

Basically, you have to learn to not have to think about initiating or responding to small talk. It has to just be second nature, and if you keep thinking "What should I say?", then you're sabotaging yourself before you've even started. By consciously thinking about small talk, your mind will overwork itself and you won't be as spontaneous. You might even hesitate when no hesitation is warranted.

Small talk actually isn't that hard, and this is coming from someone who is known as being quiet and reserved. When small talk is hard, it's our self-consciousness and insecurities getting in the way. Once you manage to get over yourself, small talk is really simple and can be basically anything small.

If you need practice that has a low risk of embarrassment, it's good to practice with old people because they are usually glad to have someone talk to and, in my experience, they have the humility to not give you the stink eye if you say something dumb. People at grocery store checkouts are good, too, and they can be either the clerks or the patrons themselves. You can make a simple remark about an item someone's buying, or even make suggestions based on what they're buying.

Just say anything! Well, almost anything. It's small talk, so obviously it's not good to bring up complex, serious, or very controversial subjects. Lose the "filter" that's preventing you from just making innocuous comments on things. I'm not going to tell you exactly what to say because small talk is very context dependent, so remarks about the weather can either be boring and cliche or the perfect way to break the silence.

There are some good kinds of questions that work I find work generally well, and they all share a theme of relatability. Everyone relates to technology, and remarks either praise or scoff at technology will generally get a response.

Is there a some relatively non-partisan current event in the news? Ask the other person what they think about it. People really love that.

"What do you think about <some song> getting banned being played on the radio?" Everyone's got opinions and strangers will usually take up your conversation.

Make a positive comment about a thing that a person owns, but be genuine about it. Those are just a few examples.

If you've got a "shower thought" that fits the context, just go with it. And if that seems bad to you, then you really need to work on losing your filter.

The moral of the story is to lose the filter. Everything after that is mostly up to you, and you can develop your own style that works with your personality, voice, and body.

Like I said, it takes lots of practice, and nobody out there has a formula that's going to turn you from someone who can't make small talk into someone who does.