So how does one know that the pope is speaking infallibly?
Because he says so?
This is a topic I no longer spend much time on. There are two Papal encyclicals which are without question accepted by all Catholics (who care to think about this question) as being ex cathedra -- Ineffabilis Deus and Munificentissmus Deus. In both cases, before issuing the document, the Pope polled the Bishops of the Church and got near unanimous agreement on the doctrine. Now, under Catholic theory on the infallibility of the church, whenever the Bishops (as successors of the office of bishop originally held by the Apostles) all speak in unison on a matter of faith and morals, that point is ipso facto an infallible dogma. So the formal Papal pronouncement in these cases, IMO, didn't really add anything. It's a bit of two paths to the same dogma.
There is some debate among Catholic theologians as to whether some other encyclicals meet the Vatican I definition. But it's not a question that keeps Catholics up at night wondering about.
I'll make it easy for you:
The pope NEVER speaks infallibly.
A Majority vote of the Magisterium, analyzing what the pope has uttered, and putting THEIR vote of confidence to it; is what makes Infallible Words.