Death only comes when a being has served its purpose. From a narrow perspective, that purpose may not be clear, but in the grand scheme of things, it makes perfect sense.
We can learn so much about the living, according to how they treat their dead. And we can see the true colours of people coming out, when we observe how they act and react, to the circumstances that come about after the death of a loved one. Lastly, we learn about the things most important in our lives, when we experience the loss called death. It is extraordinary how death can give back so much to life and to the living.