Sad situations: This one took me a while to figure out. When someone came to me with their problems, I alwas thought they were searching for a solution, so I offered my opinion on how to fix the issue. Mostly this was not so well received - I think because the person is stressed out to begin with and offering solutions gives them no excuse not to act on their problems. Most people only want emotional support, or as someone else said, their problems to be acknowledged; so a simple "I'm sorry to hear that." is usually enough. Listeing is better in these cases than talking.
Ask for reasoning: You can also pretend not to understand them, to put the "stupiditiy" on yourself instead of them. "I don't really understand how you arrived at that conclusion, could you elaborate a little further?"
Friends: Look for things you have in common with the other person, then try to arrange doing something together. If there's a movie you are both interested in, ask them to go see it with you. If they like you back, they'll most likely try to arrange to meet again. (Though sometimes you need to be persistent because others aren't that great at friend-making either.)
Compliments: Show the other person that you appreciate the compliment, because it's not something you take for granted. I think this is more humble than totally discarding them.