A good guideline when a friend loses a loved one is to express your sympathy at the funeral or visitation. If for some reason you didn't get the chance to do that, express your feelings at the first opportunity. After that, make it clear that you're willing to listen to your friend if he or she wants to talk but don't dwell on the death.
Some bereaved persons report that friends avoid them, or else they go to the other extreme and talk about the death constantly. Neither of these is appropriate. Resuming old conversational topics while allowing the person to bring up their feelings about the death is the best way to be helpful. Death is a part of life, it should not be overly discussed or avoided.
The fact is that nothing can be said to express adequately our loss or make the bereaved family feel better. But that doesn't mean that a visit and an expression of sympathy won't be helpful. Bereaved persons tell us that it's not the words that are helpful but that someone cared enough to express their sympathy in person. Sometimes just a hug or holding your friend's hand briefly is a good way to say "I care."