It is not entirely clear what was done at different periods of history. It seems most likely that, in early Church history, the bishop of Rome (which is what the pope is, as well as being the head of the whole Church) was chosen in a similar fashion to other bishops.
Group decision
Therefore, he was likely chosen by neighbouring bishops, the Roman clergy and laity of Rome all participating in the election, although the exact role of each of these groups is unclear.
Some historians thought that the popes may have appointed their successor but this is not likely from subsequent history. Two sixth century popes, Felix IV and Boniface II, named their successors in order to avoid inevitable disputes. Their right to do so was not accepted.
With the freedom of worship for Christians in the fourth century, the influence of the Roman emperors, and later the Carolingian emperors and the Italian kings, began to be felt.
This intervention could range from approval of elected candidates to their actual nomination and even to their deposition.
In some cases, confirmation by the emperor prevented dissenters from hindering the process of election. Some emperors actually nominated candidates. As late as 963, Emperor Otto I tried to require the Romans not to elect anyone unless nominated by the emperor.
However one must remember that at all times, nominations had to be accepted by the proper electors before the
individual could become pope.
Clergy demands
The history of the next centuries reveals the efforts to rid the Church of interference by secular powers. Even very early on, Roman clergy were unhappy with the involvement of secular powers to the point of being unwilling to follow papal decrees allowing intervention from outside.
Gradually, synods and popes laid down rules for elections. In 769, a decree stated that the Roman clergy were to choose the pope without participation from the laity. Because of the Roman nobility's discontent, they were again allowed to take part in 862 by Nicholas I.
In 898, John IX confirmed the custom of having imperial ambassadors present for the consecration of the new pope.
Nicholas II in 1059 at the Council of Rome decreed that the electors were to be only the higher clergy of Rome (cardinals). The lower clergy and the laity were permitted to give their approval.
The emperor was informed of the choice which was simply a concession granted him.
This, of course, was clearly an important step in freeing the selection from undue secular influence.
In addition, other regulations were put into place by this decree. Elections could also be held outside of Rome if need be.
The choice was to be made from the clergy of Rome unless there was no suitable candidate.
Cardinals select
The method to be used was to have the cardinals who were bishops meet and select candidates who were most worthy. Then, with the rest of the cardinals, they would hold the election. Remember, not all cardinals were bishops then, nor are they now.
The Lateran Synod of 1139 restricted the entire choice to the cardinals. Pope Alexander III at the Lateran Council of 1179 further stipulated that all cardinals were to be considered equal and that a two-thirds majority was required for a valid election.
Prolonged delays in the selection of a candidate meant long periods without a pope, not a good thing for the Church. To remedy this situation, at the Second Council of Lyons in 1274, Gregory X initiated strict seclusion during the process which was to begin 10 days after the death of a pope.
Rations cut
If someone was not selected after three days, the electors' food was restricted. If the results were the same after a further five days, food was restricted even more.
At first, only cardinals could be chosen pope but Alexander III decreed that "without exception, the person who was elected by two-thirds of the cardinals should be accepted as pope." A layman, Celestine V, was elected in 1294. In 1378, Urban VI, although not a cardinal, was chosen.
Regulations for the method of voting were added by Pius IV in 1562 while further modifications were added in 1882 by Pope Leo XIII. Pius X in 1904 issued a codification of previous legislation clearly removing any remnants of secular influence.
Today, the right of electing a pope belongs exclusively to the cardinals. Reforms in the process were made by Pius XII in 1945 and John XXIII in 1962. Pope John Paul himself made major revisions in the election process with his document Universi Dominici Gregis which came out in 1996.
The right of electing a pope belongs exclusively to the cardinals. Any attempt at interference by any person of whatever standing, whether civil or religious is rigorously excluded. Not even a council, which could be in session at the time of the death of a pope, can interfere.