Julian Baggini considers the question:
There are, of course, plenty of … things about a death to get upset about, most obviously our sadness for the person who has died. However, philosophers have struggled to make sense of this and, as a result, have often concluded that there is simply nothing to be concerned about. The person has died. He cannot suffer in any way. There is no point in feeling sorry about what he might have missed out on because there is no longer anyone there to feel sorry for. The only people who can feel any pain are those who survive.
I think there’s something deeply wrong about this. The sadness that one feels for the deceased is not that he is, in a strange way, still around but unable to appreciate life, but rather that he is no longer around at all. He is not suffering but nor is he enjoying, savouring, loving, laughing, or appreciating either. That is the cause of our sadness, for him or, perhaps more accurately, for what the deceased could still have been.
Many philosophers have been baffled by this, protesting that it is no more rational to feel sad for the unexperienced joys of the deceased than it is for those of the never born. But there is a huge difference between the time two people could have spent together in the real world were it not for an accident, say, and the time two people who had never been born could have spent together in a parallel, imaginary universe. The former did not come to pass when it very nearly could have, while the latter is just one of an infinite number of counterfactual possibilities. It takes a curiously impersonal perspective to assign the same value to both the unrealised experiences of purely hypothetical beings and those of people who lived and breathed. If we can delight in someone’s company, or even just derive enjoyment from a glass of good wine, then there is nothing irrational about feeling sad, perhaps painfully so, that someone we know who would have taken equal pleasure did not have the chance to do so.