The last rites, also known as the Commendation of the Dying, are the last prayers and ministrations given to an individual of Christian faith, when possible, shortly before death. They may be administered to those awaiting execution, mortally injured, or terminally ill. Last rites cannot be performed on someone who has already died. Last rites, in sacramental Christianity, can refer to multiple sacraments administered concurrently in anticipation of an individual's passing.
Viaticum and Anointing of the Sick in the Catholic Church
The Latin Church of the Catholic Church defines Last Rites as Viaticum (Holy Communion administered to someone who is dying), and the ritual prayers of Commendation of the Dying, and Prayers for the Dead.
The sacrament of Anointing of the Sick is usually postponed until someone is near death. Anointing of the Sick has been thought to be exclusively for the dying, though it can be received at any time. Extreme Unction (Final Anointing) is the name given to Anointing of the Sick when received during last rites. If administered to someone who is not just ill but near death, Anointing of the Sick is generally accompanied by celebration of the sacraments of Penance and Viaticum. The order of the three is important and should be given in the order of Penance (confessing one's sins), then Anointing of the Sick, and finally the Viaticum. The principal reason Penance is administered first to the seriously ill and dying is because the forgiveness of one's sins, and most especially one's serious (mortal) sins, is for Catholics necessary for being in a state of grace (in a full relationship with God). Dying while in the state of grace ensures that a Catholic will go to heaven (if they are in a state of grace but still attached to sin, they will eventually make it to heaven but must first go through a spiritual cleansing process called purgatory).
Although these three (Penance, Anointing of the sick, and Viaticum) are not, in the proper sense, the Last Rites, they are sometimes spoken of as such; the Eucharist given as Viaticum is the only sacrament essentially associated with dying.