A plenary indulgence is, in Catholic teaching, the full remission of the temporal punishment due to sin, as opposed to a partial indulgence, which remits only part of it. The Catechism of the Catholic Church (CCC 1471) describes an indulgence as the remission before God of the temporal punishment for sins whose guilt has already been forgiven, granted under set conditions by the Church from its treasury of the merits of Christ and the saints.
The Church's own norms (the Enchiridion of Indulgences, 1999 edition, issued by the Apostolic Penitentiary) list the usual conditions for gaining a plenary indulgence: sacramental confession, Eucharistic communion, prayer for the Pope's intentions, and freedom from attachment to any sin, all within about a few days of the act. Each work is tied to a specific act or place, such as a pilgrimage, a visit to a designated church, or a particular devotion, and the Church has at times limited how many can be gained in a day.
For the historical side, the Council of Trent and later debates over the sale of indulgences are where the Reformation disputes arose, and the Catholic Church has since reformed the practice, most notably in the 1967 Apostolic Constitution Indulgentiarum doctrina (Paul VI), which simplified the system. Other Christian traditions, such as Lutherans and most Anglicans, reject the doctrine as stated, while Orthodox churches have their own practice of prayer for the dead without a comparable system. These are the Church's documents and the scholars' accounts, and I'd point you to them directly rather than summarize beyond that.
If you want the primary texts, the Catechism's paragraphs 1471 to 1479 and the Enchiridion of Indulgences are the places to start.
My earlier answer gave the outline. Here is what the texts say, and two points where I was loose. The 1967 apostolic constitution Indulgentiarum doctrina (Paul VI, 1 January 1967) defines an indulgence in n. 1 as “the remission before God of the temporal punishment due sins already forgiven as far as their guilt is concerned.” Norm 2 says it is partial or plenary according as it removes part or all of that punishment. Norm 4 ended the older practice of stating partial indulgences in days and years, and Norm 3 says either kind can be applied to the dead by way of suffrage. The constitution also dropped the older “real” and “local” indulgences, attaching them to actions rather than to objects or places (see the 1967 norms and the full text on vatican.va).
The 1999 Enchiridion Indulgentiarum (4th edition, Apostolic Penitentiary, in Latin) sets the current conditions. A plenary indulgence can be gained only once a day, except at the point of death, where it can be gained even if another was gained that day. It requires the indulgenced work plus sacramental confession, Eucharistic communion and prayer for the Pope's intentions, and a disposition that excludes all attachment to sin, even venial sin. If any condition is missing, the indulgence is only partial. One confession can serve several plenary indulgences, but communion and the Pope's intentions must be fulfilled for each (see the Apostolic Penitentiary's Enchiridion text).
Two corrections. I said the conditions must be met “within about a few days.” I could not confirm that window in the text I opened; a secondary summary gives a window of several days before or after, so check the Latin before relying on either. I also called the daily limit something the Church has ‘at times’ set; the current rule is simply one plenary per day, with the death exception. I could not open the vatican.va Enchiridion page directly, so the conditions above come from the copy text, and the exact Latin wording remains unverified by me.