According to the Sith "Rule of Two", established by Darth Bane circa 1000 BBY, there can only be two Sith at a time. If the Sith Lords followed this rule, how is it that Palpatine, Darth Maul, and Count Dooku were all active Sith at the same time?
In this specific case, they weren't.
At the time that Darth Maul was a Sith Apprentice, Count Dooku was still a Jedi, though he was already becoming disillusioned by their order. It was only years later, after Darth Maul was thought dead1 at the end of Episode I, that Palpatine approached Dooku about becoming his new apprentice.
However, it is not true in general that there were only ever two Sith, even while the Rule of Two was theoretically in force. It was more of a general guideline than a law of the Sith. (Which makes sense; the Sith Lords wouldn't follow any rule they didn't like anyway).
As described in this answer, those Sith who stayed faithful to the Rule of Two generally seemed to have more success than those who didn't. The presence of the third Sith in the mix never seemed to go well for the Sith. So, in that sense, the Rule of Two was more of a warning: "there should only ever be two: Master and Apprentice".
This rule apparently gets violated with some regularity. Although Dooku and Maul were not active at the same time, in Phantom Menace there were three Sith active: Plageiouis, Sidious, and Maul.
1: Maul was later discovered alive in Season 4 of the Clone Wars animated TV show, and plays an important role at the end of Season 2 of the Rebels animated TV show.
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.