Last rights has since been renamed The Anointing of the Sick, or The Sacrament of The Sick, it allows the chance for a person who is close to death a chance to repent of any sins they may have committed recently that they have not repented for yet, thus giving them a much better chance of entering Heaven.
Preppy boy has it right. He's a great resource for all things Roman Catholic! The essential rite of the sacrament consists in the priest (or priests, in the case of the Eastern Churches) laying hands on the sick, anointing him with blessed oil (usually olive oil blessed by a bishop, but in an emergency, any vegetable oil will suffice), and praying "Through this holy anointing may the Lord in his love and mercy help you with the grace of the Holy Spirit. May the Lord who frees you from sin save you and raise you up." It's administered by priests only, as they were commanded in mark 6:13.
Salvation is not determined by confessing all sins the moment before death. Salvation is not determined by "extreme unction," being anointed and prayed over by a priest. Salvation is determined by personal faith in the Lord Jesus Christ (John 3:16). Thankfully, God allows for the decision of faith to be made up to the point of death. However, this must be a personal and genuine receiving of salvation by grace through faith in Jesus Christ alone (Ephesians 2:8-9). Observance of a ritual before death is meaningless in determining salvation and eternal destiny. Read more: http://www.gotquestions.org/extreme-unction.html#ixzz2OUKlc6MG