How do you comfort someone whose just lost a family member

I haven't experienced it myself and I don't really know what to say or how to make them feel better or to get them through it.

Even in person I don't know what to say or do, how do I cheer them up, without being insensitive