Baptism removes all stain of original sin, all eternal punishment for actual sins committed and all temporal punishment for those sins. The Sacrament of Penance removes only the eternal punishment for sin. It does not entirely remit the temporal punishment for our sin. We must do penance (more than the sacramental penance imposed by the priest) in order to remit the temporal punishment for our sins. We can do that in this life, or if we fail to do that, we will have a chance to do it in purgatory after we die (if we die in a state of grace).
But the Church has an incredible treasure of graces at her disposal, built up through the superabundant merits of the Blessed Virgin and the Saints. Our membership of the Communion of the Saints entitles us to call on this treasury of graces. This is what the Church calls "Indulgences".
An indulgence can be plenary or partial. A plenary indulgence remits all the temporal punishment for sin. That means that if you were to die in a state of grace, having obtained a plenary indulgence, and not sinned since obtaining the indulgence, you would go straight to Heaven. A partial indulgence does not remit all the punishment for sin.
The Church revised the norms for indulgences after the Second Vatican Council. Formerly, a partial indulgence was expressed to be an indulgence of a certain number of days or years. It was a popular misconception that these referred to the amount of time one's stay in Purgatory would be reduced. However, they instead referred to the public penances performed in the early Church. In the early Church, a person would have to perform a certain public penance for a certain number of days, weeks or months depending on the gravity of the sin. A partial indulgence was meant to equate to the merits of the public penances of that duration.
Today, a partial indulgence is obtained whenever we think pious thoughts, pray, do good works, etc. That is, the Church has recognised that all piety is in some way indulgenced, not just set prayers.
To obtain an indulgence, a person must attend confession and communion within 8 days (either side) of the indulgenced act or prayer and pray for the Holy Father's intentions (traditionally one Our Father and one Hail Mary). In addition, to obtain a plenary indulgence, one must be completely detached from one's sins, even venial sins. If one does not have complete detachment, then the indulgence is only partial.
Some examples of plenary indulgences are:
Indulgences can also be applied to the souls in Purgatory. Therefore, if you wish, you may apply a plenary indulgence or partial indulgence you have obtained for the benefit of a soul in purgatory. Obtaining a plenary indulgence for a soul in Purgatory essentially ensures that person's release from Purgatory in Heavenly Glory! What a wonderful act of Christian love! And a guarantee of an intercessor in Heaven!
Needless to say, there is a great need and benefit in the restoration of the importance of the teachings on indulgences in the modern Church!