This is a very hard topic for most physicians, and most families. Unexpected can mean anything from a healthy young person with a trauma to someone with a known pathology and a complication. I'm a neurosurgery resident and have to have these talks on an almost daily basis.
Two examples:
1) Trauma: Initially after examining the patient and reviewing associated studies, give the family a lay of the land. Use vague but descript terms that they suffered various injuries, are very sick right now, we will do everything we can, it is early to tell how they will do but with the severity of injury they may not make it. It is hard to do, but giving them the worst case scenario up front helps. Give them time to ask questions. It is impossible to place yourself in their position, acknowledge that. Update them as often as reasonably as possible on the current status of the patient. As things turn worse most families either accept or deny. In the former, some time with the family and the patient helps, listen to their stories if they want to share. In the latter, often the patient is coded, often multiple times, but inevitably do not make it. The information advantage as a doctor or nurse sometimes makes us cynical. Whenever you are talking to a family, forget about that. Just talk to them as people.
2) Complication: First, I say complication meaning unexpected death due to something unforeseen such as PE on a walking/talking patient on dvt ppx or massive hemorrhage on a patient with controlled sbp not on anticoagulation. These are never expected and take everyone by surprise. It's hard to say it, but people die. The hospital is supposed to be a safe place where this doesn't happen, but just as it happens at home, it happens in the hospital. I was walking in to work one morning and the wife of a patient was walking up the hall in tears, son and daughter in tow, and she saw me and broke down "He's dead!" I asked whatever she meant, and her husband had had a massive ICH overnight and died. She hugged me and said she knew we did everything we could. She had made him CMO instead of intubating him. The resident on overnight had done an amazing job of assessing the situation, ordering the appropriate tests, interpreting the results, and giving her the brass tacks.
While practice doesn't make perfect in these situations, it makes it less awkward. I agree, as medical students, you likely have more time to spend with families, but believe me, as residents we feel for the patients and families too.