Overall not a bad end to the season, although the pieces of the puzzle leading up to it really needed a rewrite (I felt the same way about Moffat's previous season). And it really didn't need to be the Master at all; Missy could have been a completely original character with virtually no changes to the plot and it would have worked just as well (although I did like the double lying at the end). However, given the direction part 1 seemed to be heading in I am not too disappointed overall.
I'm really bored of the "The Master is insane" trope now, I wish they had left that behind with John Simm. Glad it was the Brig that took the shot in the end though, for all the talk about The Doctor being "dark", striking the killing blow really wouldn't have been him. Having said that, it would have been nice to see him take the device and then refuse to carry out Clara's demand on principle.
And the Master's "plan" does not bear any close scrutiny. At all.
BTW, was an explanation ever given of how The Master escaped Gallifrey after that showdown with Timothy Dalton? If so I must have blinked and missed it.