How does infallibility work?
The teaching on infallibility is about the Pope's job of moral and spiritual guidance within the community of the Roman Catholic Church.
Here's a story: Suppose a business owner hires a contractor to handle certain specialized and important types of work done periodically in that business. When the owner hires this contractor, a couple of things are understood: first, the contractor will agree to perform the job and will have the necessary tools, vehicle, competence, etc., to accomplish that; in return, the contractor has a right to expect that the owner has the ability to provide for the risks and compensate for the expenses incurred by the contractor. In other words, both are on the hook: the owner won't hire this contractor for some work that the contractor is not suited for or where the owner can't be willing to "back up" or guarantee the quality of what's being done. In other words, the buck stops with the owner.
The figures of the owner and contractor are analogous to the principal figures involved in living out the command of Jesus (the owner) to the apostles, especially Peter (the contractor), to "teach all nations" with a "spirit of truth". The specific accountability for transmitting the truth of the faith is focused on Peter as an individual. But Jesus also promises that the Holy Spirit will keep the Church from error. Accountability and empowerment complement each other.
Infallibility is understood to be the asset that will allow the Church to carry out its essential mission without losing heart. The alternative, logically, is that the Church and its leadership have been placed in an impossible position: to proclaim the Gospel message as saving truth, but without a basic tool of teaching, the assurance that one's message is finally truthful. The Church and its earthly voice, the Pope, have the assurance that the Holy Spirit will not permit them to mislead the faithful on what is essential to the faith.
Note those last four words: "essential to the faith." Papal infallibility applies to the core of doctrine and the most significant matters of moral teaching, the propositions upon which all else must rest. These doctrines must be affirmed as truth for the whole of the Church. It applies to the Pope in his duty as successor of Peter to be the one finally accountable for the truth proclaimed in Christ's name. It does not apply to the individual, purely and simply, who happens to hold the office or the traits or preferences of that individual. The making explicit of a specific doctrine "from the chair of Peter" as a matter of objective truth takes place only rarely--truth is simple in its essence. Generally, the popes have spoken in this manner only on issues of serious and global significance, one that the Church in general has acclaimed for a long time.
By their nature, such issues do not happen along very often. The last time an explicitly infallible teaching was declared was in the proclamation of the Immaculate Conception of Mary, in 1950. In the encyclical message Evangelium Vitae, Pope John Paul II described the Church's basic teaching on issues such as abortion and euthanasia as well as the moral law that protects all innocent life as generally meeting the conditions of infallible truth, but he does not carry the matter to its full conclusion. Over the centuries the popes have been very cautious in any labeling of important affirmations with the term "infallible". They understand that the focus is on the matter of the teaching, not simply on the authority of the one proclaiming the teaching.