Just as any king can abdicate, Popes can vacate the Papal office. And just as with kings, such abdications are rare.
The last time the leader of the Roman Catholic Church resigned his office was almost exactly 600 years ago in 1415, and that was to end the Western Schism and reunify the Pontificate.
…the last time this happened, Gutenberg hadn’t yet invented the printing press.
Pope Gregory XII‘s resignation was a brokered political settlement: the competing claimants to the papal throne were irreconcilable, so Gregory promised that if the Avignon anti-Pope would resign, he would as well, so that an ecumenical council could elect a new man, acceptable to the Roman, Avignon, and Pisan factions. That man was Martin V.
Before that, you have a few popes forced into exile by Kings and Emperors (Gregory VII was so treated by the Holy Roman Emperor Henry IV in 1078), but that doesn’t count, for Vatican purposes, as a resignation or even a de jure end of a pontificate (“Clement III”, the guy Henry had elected to “replace” Gregory, is today counted as an anti-Pope).
There was one surprise papal resignation, in 1294. Pope Celestine V had been elected five months previously, to end the longest papal vacancy. For two full years the college of cardinals could not agree on a pope, and so kept adjourning their duties (after this, Popes were elected in conclaves, “with key” meaning they could not leave Rome until a Pope was elected).
Celestine, a Benedictine monk and ascetic, accepted the Papal office reluctantly, carried them out reluctantly, and then resigned, citing the desire to return to an ascetic live and an assessment of his own abilities. Afterwards, Celestine was imprisoned by his successor Boniface VIII, and may have been murdered. He died in 1296 and was canoninzed in 1313.
Two other popes that resigned: John XVIII in 1009 and Benedict IX in 1045. As this was during the papacy’s nadir in the tenth-eleventh centuries, they reflect the chaos of that time. The ninth Benedict in particular was a thoroughly bad hat: he was expelled from the papal office twice and resigned it once, only to return, like a bad penny. He was eventually excommunicated and his eventual fate is unknown. Current Vatican Law does not have a means for a Pope to be impeached or otherwise forced from office.
And now you know…