Things I've done or said when comforting the bereaved:
Gotten a card and either delivered or mailed it
Gone by and just sat with
Help the bereaved in anyway they need. If there's an immediate need ask if I may take care of it. I ask before doing, so that they do not think I'm taking over. I've made calls for them, ran errands, been the driver, cooked meals, been the secretary, etc.
Be a good listener, let them talk and be expressive (i.e. if they want or need to cry, let them)
Even after sometime has past I go back by or call and let them know that they are on my mind. If you go by you can really see if there is something that needs to be done. As one person noted we can ask, but 9 times out of 10 they will not let us know what they truly need.
Our close friends just lost their year and a half year old. The best thing I heard said to them as condolences was thank you so much for letting me be part of Talon's life.