The Holy Spirit guides the pope. In the sacrament of confirmation you receive the Holy Spirit and He resides in you. He doesn't control you, only guides you. He does not take away your free will or your rift to make choices. God doesn't want that cause He wants you to love Him freely.
The above answer is pretty good. The Holy Spirit does reside in the Pope in a special way because he has been chosen to be Christ's Vicar on earth, and has been granted the gift of infallibility when speaking
ex cathedra. God is certainly not going to leave the head of His Church bereft of the Spirit!