The Catholic Church teaches that the Pope is only infallible under the following strict guidelines. The Pope must be.
1. Teaching to the entire Christian World
2. In the fullness of his Apostolic Authority
3. when he is solemnly defining a matter of Faith or Morals
Now this is a very rare occurance. In fact most Theologians would only be able to cite two times in history that all agree were infallible statements from the Pope.
From a Catholic point of view, it is not so much the Pope, but the promise of God that He will not allow the Pope to teach error when the Pope makes a solemn infallible statement, that the in office of the Pope, he will not err.
As for his day to day dealings, as the Bishop of Rome, and as a private theologian, the Pope is not infallible. Only when the circumstances above occur is the Pope protected by the Charism of Infallibility. So entertaining the idea that the Pope could hypothetically proclaim something infallibly and contradict the Scritures is not possible, because of God’s promise to remain with the Church, and of Peter’s Primacy as Jesus foretold.
Since there is no authority on earth that is superior to the Pope, he cannot be deposed, or removed by anyone else. He may resign of his own accord.
There are a few stories of Popes who were ready to propose something heretical in a statement that would have been promulgated (published) as if it was infallible. From what I recall, these Popes died before they could officially promulgate the supposed claims. Some Catholic Historians and Theologians offer this as a minor proof that God prevented these Popes from teaching error as if it was an infallible statement.