The basics of why was it added and what scriptural and traditional evidence was used to add the doctrine to the deposit of faith. (Just so there is no confusion, Scriptural evidence meaning what verses in the bible where used to say “hey, papal infallibility was referenced here, here and here”, and traditional evidence being things like the writings from the early church fathers or other people like them.)
Scriptural evidence for papal infallibility includes Matt. 16:19 - “Whatever you bind on earth will be bound in heaven.” If the pope’s decisions are ratified by heaven, they can’t be false.
Also Luke 22:32 - “[But] I have prayed for you that your faith may not fail; and when you have turned again, strengthen your brethren.” If the pope’s faith can’t fail, his declarations about the faith won’t be false.
Patristic evidence for papal infallibility includes:
180 A.D. - St. Irenaeus - “For it is a matter of necessity that every Church should agree with [the Roman Church], on account of its preeminent authority.”
source
256 A.D. - St. Cyprian - “[F]aithlessness could have no access” to the Roman See because it is “the chief church whence priestly unity takes its source.”
source
367 A.D. - St. Optatus of Mileve - “[A]nyone who would set up another chair in opposition to [Rome] would, by that very fact, be a schismatic and a sinner.”
source
431 A.D. - The Third Ecumenical Council - Session 1 - “[If] your holiness * have not a mind to [accept] the limits defined in the writings of [Pope] Celestine, Bishop of the Church of Rome, be well assured then that you have no lot with us, nor place or standing among the priests and bishops of God.”
source
451 A.D. - The Fourth Ecumenical Council - Session 2 - [After a declaration of the faith by Pope St. Leo the Great.] “This is the faith of the fathers, this is the faith of the Apostles. So we all believe, thus the orthodox believe. Anathema to him who does not thus believe! Peter has spoken thus through Leo! So taught the Apostles. Piously and truly did Leo teach, so taught [St.] Cyril [of Alexandria].”
source
And: The Fourth Ecumenical Council’s Letter to Pope Leo I - “[Pope Leo is] the mouthpiece unto all of the blessed Peter…imparting the blessedness of his Faith unto all.”
source
680 A.D. - The Sixth Ecumenical Council - Session 4 - “[The Roman see] has never erred from the path of the apostolic tradition, nor has she been depraved by yielding to heretical innovations, but from the beginning she has received the Christian faith from her founders, the princes of the Apostles of Christ, and remains undefiled unto the end, according to the divine promise of the Lord and Saviour himself.” (Citing Luke 22:31-32)
source
And: “[Peter] received from the Redeemer of all himself, by three commendations, the duty of feeding the spiritual sheep of the Church; under [his] protecting shield, [the Roman Church] has never turned away from the path of truth in any direction of error, whose authority, as that of the Prince of all the Apostles, the whole Catholic Church, and the Ecumenical Synods have faithfully embraced, and followed in all things.” (ibid.)
source
The Sixth Ecumenical Council’s Letter to Pope Agatho - “Christ our true God…gave [us] a wise physician, namely your [self], to drive [heresies] away…by the remedies of orthodoxy, and to give the strength of health to the members of the church. Therefore to you, as to the bishop of the first see of the Universal Church, we leave what must be done, since you willingly take for your standing ground the firm rock of the faith, as we know from having read your [letter] to the most pious emperor: and we acknowledge that this letter was divinely written as by the Chief of the Apostles.”
source
787 A.D. - The Seventh Ecumenical Council - Session 2 - “[The letter] to the Romans commend
their zeal for the true faith… It is necessary to follow out this witness, and he that would contradict it is without good sense. Wherefore Hadrian, the ruler of Old Rome, since he was a sharer of these things, thus borne witness to, wrote [to the emperor]…confirming admirably and beautifully the ancient tradition of the Catholic Church… so [we] have confessed, so [we] do confess, and [we] so will confess… And the holy Synod said: The whole holy Synod thus teaches.” source
And: “[You will be] renowned and praised through the whole world…if you follow the tradition of the orthodox Faith of the Church of the holy Peter and Paul, the chief Apostles, and embrace their Vicar… For the holy and chief Apostles themselves, who set up the Catholic and orthodox Faith, have laid it down as a written law that all who after them are to be successors of their seats, should hold their Faith and remain in it to the end.” source
I think all of this is very strong evidence for papal infallibility in the early Church.*