The cardinals did not always elect the Pope: the Pope was originally elected by the people of Rome, but during the medieval times the right of election was gradually restricted until only cardinals possessed it. But the current Pope or any future Pope could substitute another body of electors for the College of Cardinals at any time; in fact there have been proposals in the past to have the Synod of Bishops perform this function (the proposals have not been adopted because, among other reasons, the Synod of Bishops can only meet when called by the Pope).
In early modern times, English and French monarchs had cardinals as their chief ministers - Wolsey in England, Richelieu and Mazarin in France. These men were cardinals, not because of their religious duties, but because it allowed their kings to pay them from church revenues. Rome accepted the loss of some revenue in order to protect the rest of its property and revenue.
The word 'cardinal' comes from Latin for door-hinge, for the cardinals are supposed to be the 'hinges' of the church. The Latin form of the title is Cardinalis.
According to Canon 350 of the Code of Canon Law, the College of Cardinals is divided into three orders, viz., the episcopal order (cardinal bishops), the presbyteral order (cardinal priests), and the diaconal order (cardinal deacons). The cardinal bishops are those cardinals to whom the Pope assigns the title of a suburbicarian church, and such Patriarchs of the Eastern Rite Churches as the Pope sees fit to appoint to the College (Eastern patriarchs retain the titles of their patriarchal sees). The cardinal priests and cardinal deacons are each assigned a title or deaconry in Rome by the Pope. Note that cardinal priests and cardinal deacons are actually bishops.
Although originally any Catholic male could be appointed to the College, today only bishops are normally created cardinals. Canon 351 specifically requires that a cardinal at least be in the order of priesthood, and those who are not already bishops must receive episcopal consecration. A recent example is Rev. Avery Dulles, S.J, who was a priest at the time of his elevation to Cardinal in 2001. He successfully petitioned the Pope for a dispensation from episcopal consecration due to advanced age.
Pope Sixtus V limited the number of cardinals to 70 (6 cardinal bishops, 50 cardinal priests, 14 cardinal deacons), after the College had expanded in the 16th century. Popes since John XXIII have disregarded this limitation in order to make the college of cardinals a more representative body. Only those cardinals under age of eighty (nominally limited in number to 120 by Paul VI, but John Paul II has disregarded this as well) participate in the election of the pope. The six cardinal bishops elect a Dean of the College of Cardinals to be their head (the dean is primus inter pares, "first among equals"); the election must be approved by the Pope. The present Dean is His Eminence Joseph Cardinal Ratzinger, the Prefect of the Congregation for the Doctrine of the Faith.