According to the novelisation, and the Doctor Who Magazine comic strip The Fallen, he ate a "morphant" before his execution. As for what actually happened to his body chemistry, we have no idea.
There's a slightly different version in the novel The Eight Doctors--it's called a "deathworm" instead of a "morphant", and he didn't have to eat it to "transfer his essence". But it's basically the same idea.
Even without accepting novels and magazines as sources, we know he was put on trial. He therefore had warning that his life was in danger. He can safely be assumed to have taken precautions, even if we don't know what they were (apart from requesting that his remains be returned to Gallifrey, so as to be taken off Skaro).
He's the Master. He's tricky. He can't be trusted. He can't even be trusted to stay dead.