The Rule of Two is a philosophy created by Darth Bane as the overarching multi-generational strategy to destroy the Jedi - the Sith are not bound by any magic or law to abide by it, and can violate it if they choose to. In the particular case of Palpatine, Maul and Dooku, the answer depends on whether you're looking at Legends or the new canon.
In Legends, it had been assessed by the reign of Darth Plagueis, Palpatine's master, that the time for the Sith's revenge is nigh and the Rule of Two has served its purpose. Palpatine proposed to Plagueis for himself to take Maul as a student but not a Sith, thereby not openly violating the Rule of Two. Maul was intended to be a proxy for the Dark Lords of the Sith to openly confront the Jedi without exposing the identity of either Lords. That Maul was called a Sith and a Darth was purely a case of misjudgement by the Jedi, who falsely believe that just because he wields the dark side and a crimson-bladed lightsaber means he is one of the two Sith Lords.
Darth Plagueis was murdered on the eve of Palpatine's formal appointment to the office of Supreme Chancellor, so when Palpatine subsequently took Dooku as his apprentice, he could take him in formally as a Sith Lord and Darth and preserve the Rule of Two.
In Disney's new canon, Palpatine took Maul as an apprentice and thus Sith Lord, then - because there can be only two - he proceeded to duel and defeat Plagueis, therefore preserving the Rule of Two. How is this so? It can be attributed to the mechanics of the Rule explained when Darth Zannah - apprentice of Darth Bane, founder of the Rule - prepared for her own challenge: The Apprentice will first seek out and adopt a student of her own before challenging the Master. The Apprentice will then challenge the Master - and the student is required not to interfere. If the Apprentice is victorious, then she will become the Master and the student immediately becomes the new Apprentice - the Sith Order will not be exposed to the risk of a freshly promoted and possibly battle-fatigued Master accidentally dying before a new Apprentice is inducted and trained. If the current Master is victorious, the Apprentice dies and the student is at the Master's mercy as to whether he will be a suitable replacement. This is the most probable scenario of what happened between Plagueis, Palpatine & Maul. As for Dooku, he simply became Palpatine's apprentice after Maul's supposed death.