According to Catholicism, if someone receives last rites, is everything forgiven? So you've killed dozens of people, cheated on wife, destroyed families blah blah. Then before dying the priest administers you the last rites. Is everything forgiven? Will you go to heaven because you confessed?

I'm confused at this; what's the incentive to be good throughout life?
The Catechism of the Council of Trent on Extreme Unction quotes St. James 5:14-15:

Is any man sick among you? Let him bring in the priests of the church and let them pray over him, anointing him with oil in the name of the Lord. And the prayer of faith shall save the sick man. And the Lord shall raise him up: and if he be in sins, they shall be forgiven him.

Describing the effects of Extreme Unction, the Catechism says:

this Sacrament is imparted grace that remits sins, and especially lighter, or as they are commonly called, venial sins; for mortal sins are removed by the Sacrament of Penance. Extreme Unction was not instituted primarily for the remission of grave offences; only Baptism and Penance accomplish this directly.
Another advantage of the Sacred Unction is that it liberates the soul from the languor and infirmity which it contracted from sins, and from all the other remains of sin. The time most opportune for this cure is when we are afflicted with severe illness and danger to life impends, for it has been implanted in man by nature to dread no human visitation so much as death

See also the 14th session of the Council of Trent on the Sacraments of Penance and Extreme Unction.