The ceremonies performed for a dying person are referred to as "rites of passage." These ceremonies have two purposes: they cleanse the body and, more significantly, they quiet the psyche.
The first is usually accomplished by the application of holy things such as Ganges water or a Tulsi leaf.
In certain situations, the dying person will also clutch a cow's tail, which, according to common belief, will allow them to bridge the Vaitarani River, which leads to the afterlife.
The concept that one's dying thoughts have significant karmic implications for future lifetimes underpins the focus on relaxing the dying person's psyche.
Any kind of anxiety or excitement is thought to have bad results, thus the dying person should be quiet and serene.
Reading passages from religious literature, whether to remind the hearer of the body's impermanence or to have the last thing one hears be the name of God, is one way to assist develop such peace.
The dying person is often laid on the dirt at the point of death, maybe to allow the earth to absorb the corpse's impurity (ashaucha), or perhaps as a sign that, regardless of one's rank in life, all human beings finally share the same end.
Following death, the antyeshthi samskara ("last rituals") ceremonies, which are the next set of rites in the sequence known as the antyeshthi samskara ("final rites"), commence.
See antyeshthi samskara.
You may also want to read more about Hinduism here.
Be sure to check out my writings on religion here.