Martin Luther's original problem was not with the doctrine of Purgatory, which he originally accepted, but with the way indulgences were being preached by such characters as Johann Tetzel, against whom he railed. Of his 95 theses, 13 mention Purgatory in a matter-of-fact way, but 40 criticize indulgences.
Blessed Pope Paul VI gave the following definition of an indulgence in his 1967 apostolic constitution Indulgentiarum Doctrina, which also appears in canon 992 of the Code of Canon Law and paragraph 1471 of the Catechism of the Catholic Church:
An indulgence is the remission before God of the temporal punishment due sins already forgiven as far as their guilt is concerned, which the follower of Christ with the proper dispositions and under certain determined conditions acquires through the intervention of the Church which, as minister of the Redemption, authoritatively dispenses and applies the treasury of the satisfaction won by Christ and the saints.
An indulgence may be applied to oneself or offered for the faithful departed. Soliciting the Church's intervention on behalf of the dead wasn't invented by the Catholic Church but inherited from the Jews, as 2 Maccabees 12:43–46 shows: "And making a gathering, he sent twelve thousand drachms of silver to Jerusalem for sacrifice to be offered for the sins of the dead. ... It is, therefore, a holy and wholesome thought to pray for the dead, that they may be loosed from sins."
To obtain an indulgence one must be a Catholic in a state of grace and perform a work indulgenced by the Church with the intention of gaining that indulgence. Only one indulgence can be obtained per day and requires that the person be completely detached from all sin. Unless legitimately impeded, it's also required that within 20 days before or after the work, the faithful will have received Holy Communion, gone to confession and prayed for the pope's intentions.
A plenary indulgence remits all the temporal punishment due to one's sins. A partial indulgence is "an equal remission of punishment through the intervention of the Church" that is "in addition to the remission of temporal punishment acquired by the action itself." A current list of indulgenced works can be found in the Enchiridion of Indulgences.
Watch the panel discuss God's mercy for the holy souls in The Download—Purgatory.