I find it funny that people seek me out for this kind of advice, because I struggle with the answers to these questions as much as anyone does. But I have learned a few things that do help when I bring them to the table.
First, know what outcome you want. A conversation is a meeting, and every effective meeting has an agenda. Be clear on your goal for any conversation before you start it.
Second, be honest about that agenda, with yourself and with the other parties to the conversation. Agendas are not nearly as effective when they are hidden. Wouldn't a lot of conversations be shorter and more satisfying if the other person would just tell you honestly what's on their mind up front? A corollary to that is to watch out for your assumptions. Having a goal in mind does not give you permission to dismiss, disrespect, manipulate or railroad the other person into giving you your way.
Third, be open to the other person's agenda and goals for the conversation. Their needs may not be what you think they are. If you're not sure, ask.
When you're in a conversation, especially when it gets uncomfortable for any reason, think before you speak. And specifically, think about whether whatever you're about to say could be phrased as a sincere, open-ended question. Questions keep doors open. They demonstrate a desire to understand and learn. Questions are the mechanism through which adults communicate. To borrow the classic line from Dr. Stephen Covey, "Seek first to understand, then to be understood."
Questions can also be a way to defuse a conversation that's turning ugly. Rather than make a strong statement in response to a strong statement, ask a question that gives the other person permission to get the anger, frustration, or other intense emotion out of their system. Even something like "I don't understand" or "say more about that" tells the other person you are listening. Of course, if the response is still heated, it may be time to walk away and come back to it after everyone's had a chance to calm down.
It's perfectly OK, if you don't know "what to say when...", to say so! Nobody has all the answers, and "I'm not sure what to say" is a very human way to keep a conversation going when it might otherwise fall apart. Give the other person permission to help you achieve your conversational goals by being honest, asking plenty of questions, and listening carefully.