One of the great blessings of the gospel is the sealing power that binds families together for eternity. This power was held by many of the ancient prophets. It was lost from the earth during the great apostasy that promptly followed the death of the Savior's original apostles. Elijah came to the prophet Joseph Smith to restore this power. This restoration was prophesied by Malachi: "Behold, I will send you Elijah the prophet before the coming of the great and dreadful day of the Lord: And he shall turn the heart of the fathers to the children, and the heart of the children to their fathers, lest I come and smite the earth with a curse" (Malachi 4:5-6). To someone who lost a child or a parent or a sibling to the dark clutches of death, these words resonate with a euphonious and joyful sound. Hearts readily turn to those who are dead. What is comforting is that with the sealing power, as hearts turn there is more than just longing; there is real power in the sealing of a family together. The bonds of family continue beyond the grave and into the eternities. That's the great blessing of the gospel - we can be together forever with our family. This sealing occurs in the temple. Sealing the generations together is "the great work...done in the temples of the Lord in the dispensation of the fullness of times" (D&C 138:48).
In the Kirtland Temple in 1836 the Prophet Joseph had a vision of the Celestial Kingdom (see D&C 137). He saw some there who died before the restoration of the gospel (particularly his brother Alvin). He marveled that people like Alvin could be exalted without having received the gospel while they were alive. This is one of the most liberal and amazing blessings from our Heavenly Father. All will have the opportunity to receive the ordinances of the gospel either in this life or in the life to come. They can accept or reject those ordinances - they can choose not to fully consecrate themselves to Truth and the Lord - but they will have the choice. The doctrine that is even more comforting, particularly to parents who lose their little ones, is that all children who die before they reach accountability will be saved in the celestial kingdom as Joseph saw in vision: "I also beheld that all children who die before they arrive at the years of accountability are saved in the celestial kingdom of heaven" (D&C 137:10). That's a very comforting doctrine; I also think it can add extra incentive for parents to live righteously so they will be able to live with their children again!
Death need not seem completely tragic. As the Prophet Joseph said: "The only difference between the old and young dying is, one lives longer in heaven and eternal light and glory than the other, and is freed a little sooner from this miserable, wicked world. Notwithstanding all this glory, we for a moment lose sight of it, and mourn the loss, but we do not mourn as those without hope" (Source).
Link to part 6 of this essay.