It's never specifically mentioned (So far as I know, how) however it may be that the Time Lords simply opened the Eye of Harmony and used their advance scientific ability to extract him. Or they may have brought him from another point in time. The possibilities of how he was brought back are rather limitless, actually. But, until and unless the producers wish to divulge that little fact, we'll likely never know for sure.the Master's biodata extract must have existed within the Matrix on Gallifrey. At some point, the physical/fictional connection between the Matrix and the Citadel (the door seen in the Ultimate Foe that allowed the 6th Doctor to physically enter the fictional Matrix construct) could be used to recreate the Master from that biodata extract.
(As a side note, Mel in "The Ultimate Foe" might also have been a construct of the Matrix, which would explain the Doctor's attitude toward here. The Valeyard may also have been constructed from a fictional extrapolation of the Doctor's biodata extract into predicted future events.)
Fictional energy was first seen explicitly in Doctor Who in The Land of Fiction, although something like it was mentioned by the 1st Doctor in "The Chase". It has appeared in recent episodes of Doctor Who ("Fear Her") and Torchwood (From Out of the Rain).
There is a strong suggestion that fictional energy interacts with possibility (the "causal nexus"), with the energy of the Vortex ("Artron energy"), and with psychic abilities.