Life and death are both part of what Hindus call maya, a grand illusion; Hindus believe that when a soul dies, it gets born into a new body. The cycle of death and rebirth -- samsara -- ends only when a soul realizes its true nature -- indistinguishable from the absolute godhead, which Hindus call Brahman. This realization -- moksha -- is liberation, and it may take many lifetimes of effort in a human body to attain.
Heaven and Hell
According to the Puranas, which are Hindu sacred texts, there are 14 realms of existence; seven are lower than the human realm and six are higher, putting the material world in which we dwell in the middle. The higher worlds are Svarga, which means heaven, and the three highest realms constitute Brahmaloka, the world of Brahman, or God. The lower worlds, which are worlds of suffering and depravity, are known as Naraka -- a word that comes from the Vedas, the oldest Hindu scriptures. The nether worlds are also known as Yamaloka, the world of Yama, Lord of Justice, who punishes sinners for their sins.
The Moment of Death
Karma -- the sum total of a soul's moral actions throughout its incarnations -- is the main determinant of a soul's direction after death, but other factors come into play. In particular, a person's state of mind is important. Taking to heart a passage in the Bhagavad Gita in which Krishna tells Arjuna that whoever thinks of God at the time of death goes straight to God, many Hindus strive to die thinking higher thoughts. Those whose thoughts wander may have to pass though the realms of Yama to purify themselves, but they can be aided by the prayers and offerings of relatives, especially during the first two weeks after death.
The Afterlife and Salvation
The realms through which the soul travels after death, even the highest ones, are part of samsara, and as such, are just as impermanent as the earthly realm. Souls leave the lower realms when they have learned the lessons they need to learn, and they leave the higher realms when desire draws them back to the material world, where they generate new karma. This cyclical movement is ceaseless and is generated by a soul's own belief in its separateness from the Absolute. Salvation comes through the cessation of grasping, desire and belief in this separation.
Good and Bad Deaths
Even though it is just a transition, Hindus aspire to a death that leads to a place of peace and fulfillment rather than one of suffering and pain. A good death is one that occurs at an auspicious time and to which the person can surrender willingly and peacefully. A bad death, on the other hand, is one that is premature or violent. To facilitate a good death, a Brahmin priest may help the dying person to stay focused on God, perhaps by chanting the name of Ram or a healing mantra. A person who has died well has a peaceful expression, and the eyes and mouth -- through which the spirit exits -- are slightly open.