Determining just which popes have resigned is actually difficult because the records of church history are in such disarray for so many centuries. Some place the number as high as 10, some as low as four it all depends upon how one defines a resignation and how the data is interpreted.
Pontian (230-235) was the first pope to resign and his case is clear. Pontian had the misfortune of being caught up in the severe persecution of Christians under emperor Maximinus Thrax and was sent to the mines on Sardina, a place from which few evidently managed to return alive. Pontian knew that he would almost certainly die on Sardina and didn't want there to be a long-term power vacuum in the church, so he decided that abdication would be the best course of action. Pontian's abdication also gives us the first certain date in the history of papacy: September 28, 235.
Marcellinus (296 - 304) didnt actually resign, but his actions probably caused him to cease being pope. During the Diocletian persecutions of 303, Marcellinus handed over scriptures to Roman authorities and burned incense to the pagan gods. Such actions would have disqualified him from the priesthood and, therefore, the papacy. His name was kept off the official list of popes for a while, but today he is there and his papacy is marked as ending with his death.
Silverius (536 - 537), son of Pope Hormisdas, was deposed and exiled by empress Theodora of Constantinople, brought back by emperor Justinian to stand trial, convicted, and forced by his successor Pope Vigilius to abdicate again. He starved to death on an island in the Gulf of Gaeta.
John XVIII (1003 - 1009) didnt do much that survived in the records, but it is believed that he resigned and lived out the last years of his life in a monastery.
Benedict IX easily had the most confusing pontificate in history. He served as pope three times: he was elected, ejected, returned, abdicated, deposed, returned again, ejected again, and eventually excommunicated. Presumably at least one of his resignations may have been canonically valid, possibly even two.
Celestine V (1294) tried to rule while under the control of Charles II of Sicily, something he quickly determined wouldnt be possible. Rather than serve as little more than a figurehead for secular powers, he simply abdicated the papal office after only 5 months. This resignation helped establish as a matter of church law that a pope may freely resign his office.
Gregory XII (1406 - 1417) was another pope who resigned for the greater good of the church. He reigned during the Western Schism and at the time there were two other rivals claiming the papacy, both with genuine support among various churches and secular powers. He agreed to abide by the decision of the Council of Constance with just one condition: that he be permitted to officially convene it. This condition was granted, thus establishing the validity to his claim to the papacy, and he resigned so that the council could elect Martin V as his successor. Gregory was the last pope to resign his office.