The Definition of Last RitesIn the Christian religion, last rites are the last prayers and ministrations given to many Roman Catholics when possible shortly before death. The last rites go by various names and include different practices in different Catholic traditions. They may be administered to those awaiting execution, mortally injured, or terminally ill.
The ministration known as the last rites in the Catholic Church does not constitute a distinct sacrament in itself. It is rather a set of sacraments given to people who are believed to be near death.
These are the sacraments of Anointing of the Sick (which, in spite of not being reserved for those near death, is sometimes mistakenly supposed to be what is meant by "the last rites"), Penance and the Eucharist. If all three are administered immediately one after another, the normal order of administration is: first Penance then Anointing, then Viaticum.
The last rites are meant to prepare the dying person's soul for death, by providing absolution for sins by penance, sacramental grace and prayers for the relief of suffering through anointing, and the final administration of the Eucharist, known as "Viaticum," which is Latin for "provision for the journey."
Reception of the Eucharist in this form is the only sacrament essentially associated with dying. Accordingly, "the celebration of the Eucharist as Viaticum is the sacrament proper to the dying Christian".
In the Orthodox Church and those Eastern Catholic Churches which follow the Rite of Constantinople, the last rites consist of the Sacred Mysteries (sacraments) of Confession and the reception of Holy Communion.
Following these sacraments, when a person dies, there are a series of prayers known as The Office at the Parting of the Soul From the Body. This consists of a blessing by the priest, the usual beginning, and after the Lord's Prayer, Psalm 50. Then a Canon to the Theotokos is chanted, entitled, "On behalf of a man whose soul is departing, and who cannot speak".
This is an elongated poem speaking in the person of the one who is dying, asking for forgiveness of sin, the mercy of God, and the intercession of the saints. The rite is concluded by three prayers said by the priest, the last one being said "at the departure of the soul."
There is an alternative rite known as The Office at the Parting of the Soul from the Body When a Man has Suffered for a Long Time. The outline of this rite is the same as above, except that Psalm 70 and Psalm 143 precede Psalm 50, and the words of the canon and the prayers are different.
The rubric in the Book of Needs (priest's service book) states, "With respect to the Services said at the parting of the soul, we note that if time does not permit to read the whole Canon, then customarily just one of the prayers, found at the end of the Canon, is read by the Priest at the moment of the parting of the soul from the body."
As soon as the person has died the priest begins The Office After the Departure of the Soul From the Body (also known as The First Pannikhida).
In the Orthodox Church Holy Unction is not considered to be solely a part of a person's preparation for death, but is administered to any Orthodox Christian who is ill, physically or spiritually, to ask for God's mercy and forgiveness of sin. There is an abbreviated form of Holy Unction to be performed for a person in imminent danger of death, which does not replace the full rite in other cases.Source
The Catholic Encyclopedia (1914 ed. in the public domain), "Pilgrimage" with minor edits.