The Rule of Two was a law for the Sith established by Sith Lord Darth Bane so the Sith to operate in secret and eventually get revenge on the Jedi Order for their near annihilation in the Jedi-Sith War. Successor to the Doctrine of the Dyad, the law decreed that only two Sith Lords must exist at any given time: a master to represent the power of the dark side of the Force, and an apprentice to crave it and train under the master and to one day fulfill their role. This governed the Lords of the Sith.
The Rule of Two was preceded by the Doctrine of the Dyad, which was based on the Force dyad, a rare type of Force-bond between two Force-sensitives that transcended space and time. Ancient legends referred to the dyad as the source of unique Force powers, such as Force healing, and the ability to transfer objects through the Force. The Doctrine of the Dyad was inscribed on the walls of the Sith Citadel, an ancient Sith stronghold located on the planet Exegol, to remind the Sith of the dyad’s significance in their quest to attain ultimate power. The Sith Eternal, a cult of Sith loyalists, revered the Doctrine of the Dyad, believing that the dyad symbolized the future of the Sith and was the key to achieving the full potential of the dark side of the Force.
The concept of the Rule of Two, the relationship between a Sith Master and a Sith apprentice, was part of ancient Sith doctrine since the time of the Great Scourge of Malachor. The masters demanded loyalty from their apprentices, but they sometimes betrayed them if they found one with more potential. In ancient times, the Sith were often ruled by two Dark Lords while many others existed at the same time.