In any situation try to look for positive aspects. Sometimes people are so frustrated or exhausted by constant experience that to find the bright side he simply does not remain forces. Try to find something positive and cheer up his friend. To draw the story as a joke may not always be appropriate, so try to lighten the mood accurately, but to make a sad story a certain amount of optimism you can. Of course, there are situations in life in which quite clearly there can not be anything good. It is not necessary to look for the positive moments in the loved one's death or severe illness – you just completely spoil the mood of the person and can adjust it against yourself.
Try to avoid cliches and pre-prepared words. Standard "I'm sorry" often sounds very dramatic and unnatural. In addition, in this phrase there is absolutely nothing comforting, man she just remind you of his misfortune. Better invest the same meaning in other words, say: "I am very sorry that it happened." If the situation is not so gloomy and it is about ordinary life troubles, support person warm words and try to distract from gloomy thoughts. Sometimes you just need to hear a funny story from the life of a friend or of the old school of life that the soul has become much brighter.
Without going into the stories from the series "what is This, but I had...". First, the person with problems is always less interesting to hear about the misfortunes of others. And second, such stories often even more angered listeners by reminding them of their unfortunate fate again and again. If you want to support something not related difficulties and complex life situation, and just share the good news or his cheerful mood.