The numbering follows the official list of the Holy See, the one printed in the Vatican’s yearbook, the Annuario Pontificio. Leo XIV is the 267th pope. Benedict IX, who held the office three separate times in the eleventh century, is counted at each of his three reigns (145th, 147th and 150th), so 265 men have been pope.
A priest named Stephen was elected in March 752 and died a few days later, before he was consecrated. Older lists counted him as Stephen II, but the official list has left him out since 1961, which is why the later Stephens are sometimes given two numbers, such as Stephen II (III). Antipopes, men who claimed the papacy against a lawful pope, are not included.
For the first centuries the dates are those of tradition: the early lists of Roman bishops give the order and the approximate length of each reign, but rarely exact dates, and much of what later writers said about these popes, especially in the Liber Pontificalis, cannot be checked. Where a story is legend or uncertain, the pope’s page says so. Dates of election are given as recorded at the time (before 1582, in the Julian calendar).
The documents on each pope’s page link to the Holy See’s website, vatican.va, which publishes papal texts mostly from Leo XIII (1878) onward, with a selection from earlier centuries. Some are available only in Latin or Italian; the list says so. Each list is a selection of the most important texts; the Vatican’s site has the rest.