On the death or abdication of a pope, his successor is elected by a college of cardinals meeting in conclave in the Sistine Chapel in the Vatican.
The system of election has been changed several times over the 2,000 years of the papacy's existence.
All recent popes have changed the rules governing the choice of their successor, except for John Paul I, whose death on September 29, 1978 left him no time to reform the system during his 33-day papacy.
Pope Benedict XVI, who announced on Monday he would resign, altered the rules for the choice of his successor to ensure that the new pontiff enjoys as widespread support as possible.
Under the change, the new pope will have to be elected with a two-thirds majority, however many rounds of voting the process might take.
In a "motu proprio", or personal decree, Benedict XVI reversed a measure adopted in 1996 by his predecessor John Paul II in an "apostolic constitution".
Here is a factfile on how popes are chosen:
* In 1970 Pope Paul VI determined that the college of cardinals was to be limited to 120, with a maximum age of 80. He also ordered measures to prevent bugging of the proceedings.
* During the interregnum, the cardinal camerlengo is temporary head of the Roman Catholic church. If the outgoing pope has died, the camerlengo arranges the funeral and burial of the deceased pope and organises the election of his successor, assisted by three cardinals who are elected by the college of cardinals, with three new cardinals elected every three days.
* The electoral conclave must meet at least 15 days, but no more than 20 days, after the pope's death or resignation. The cardinals must take an oath of secrecy when they enter the conclave. The penalty for breaking the oath is automatic excommunication.
* Since 1271, when, following a deadlock, the cardinals were locked up and given only bread and water as a means of inducing them to draw the proceedings to a close, they have been required to remain in total isolation during the deliberations, with only a doctor and a cook to assist them.
* The vote is by secret ballot. Cardinals are not allowed to vote for themselves. Four ballots are held each day, two in the morning and two in the evening, until a result is obtained. The ballot papers are burnt after each count. If a new pope has been elected, the papers are burned with a substance that gives off white smoke, to signal the news to the waiting crowds outside. If no candidate has succeeded in gaining the necessary two-thirds majority, the smoke given off is black.
* Once a cardinal has been chosen, he is asked if he agrees to become pope and what name he wishes to be known by. Once he has done this, he immediately becomes Pontifex Maximus, the Holy Roman Pontiff.
* The dean of the college of cardinals then steps on to the main balcony of the Vatican and declares to the world: "Habemus Papam!" "We have a Pope!" The new pope then appears on the balcony and delivers his apostolic blessing.