He doesn't. He just knows, deep down, that it's safe. That was the meaning behind the dream at the end of "The Day of the Doctor".
At the point when the Tenth & Eleventh Doctors' timestreams crossed that of the War Doctor, the War Doctor had decided to use the Moment to destroy both the Daleks & Gallifrey, so that was the last event he could remember once the timestreams uncrossed again.
However, by the time the Twelfth Doctor's timestream crossed that of the Eleventh Doctor, the plan to save Gallifrey had already been set in motion, so the Eleventh Doctor remembered that much. As the dialogue indicated, once the Twelfth Doctor was no longer present, none of the other Doctors was sure that the plan had succeeded -- but the Eleventh Doctor did retain the memory of making the attempt. (The War Doctor & the Tenth Doctor, in contrast, didn't retain that memory, because the Eleventh Doctor had been present throughout.)