I have a theory as to how the master was brought back in S12.
Soooo, my theory is:
Wee know that missy was killed but what if the time lords brought her back? Like we know they are trapped into that pocket universe but they did manage to send some regeneration energy via the crack to 11.
Maybe somehow they did the same to master? So, master regenerates and questions how and why (maybe his insanity is also due to that). For that, he goes back to Gallifrey , ends up messing with the matrix and boom! Finds the truth.
In his rage, he kills everyone, steals a tardis and put his plan into motion.






