The Papal States' legal claim rested for centuries on the Donation of Constantine, a document purporting to record the emperor Constantine granting the pope authority over Rome and the western empire. It was invoked to justify papal temporal power against rival claimants for most of the medieval period, until the humanist scholar Lorenzo Valla demonstrated in 1440, through careful analysis of the document's Latin and its historical anachronisms, that it was a forgery, almost certainly produced centuries after Constantine's death. The demonstration did not end papal temporal rule, which continued on other grounds for another four hundred years, but it permanently undermined the document's credibility as a historical basis for the claim.
The loss of the states in 1870 produced a diplomatic standoff rather than a settled question: successive popes refused to accept the annexation, declined to leave the Vatican, and declared themselves prisoners within it, a position known as the Roman Question that remained formally unresolved for nearly sixty years. It was finally settled by the Lateran Treaty of 1929 between the Holy See and the Kingdom of Italy, which recognized papal sovereignty over a much smaller territory, Vatican City, in exchange for the papacy's formal renunciation of any claim to the former Papal States.
The current Vatican City State is therefore best understood as the settlement of a nineteenth century dispute rather than a survival of the original medieval territory.
Sources De falso credita et ementita Constantini donatione (On the Donation of Constantine)Lorenzo Valla with Lateran TreatyThe Holy See and the Kingdom of Italy