One of the Popes was a 100% accident. In the Middle Ages, cardinals would often vote for a random candidate on the first papal ballot in order to see how the other cardinals were leaning, but in 1334 this backfired when they all voted for the same person: the very surprised Pope Benedict XII.