Canon
Although Kylo Ren is not a Sith, he managed to find a Sith-ish Master to teach him the ways of the Dark Side. Where this Master learned what he knows is not explored in The Force Awakens, but any of the explanations I explore below are plausible.
Legends
At least once during the time of the Rule of Two, the Master was killed by someone other than the Apprentice. What ended up happening was that the Apprentice took on the mantle of Master, and took an Apprentice of his own.
In Legacy of the Force, the Dark Lady Lumiya is killed by Luke Skywalker. Her apprentice, Darth Caedus went underground before emerging as the new Dark Lord; from Wookieepedia.
The other thing, with both the Master and Apprentice being killed, sort of happens shortly afterwards; Caedus is killed, but his apprentice (Tahiri Veila) was merely redeemed, and turned away from the Dark Side. Although she wasn't slain, she exiled herself and played no part in the re-emergence of the Sith.
That re-emergence was thanks to Darth Krayt, who actually created a Sith Empire that ran concurrently to Lumiya and Caedus' reign. While Lumiya learned from Darth Vader, Krayt went directly to the source: the ghost of XoXaan, an ancient Sith Lady, and her holocron.
It's important to remember than, in Legends, the Sith Order has been around for a very long time, with their origins (at least in a form we would recognize) dating back 7000 years before the events of the movies. There have been dozens, if not hundreds of Sith Lords; many of them made holocrons, and some of them remained as malevolent Force ghosts after their death. There is plenty of ancient Sith lore lying around, waiting for a disillusioned Jedi to ask the right questions (or the wrong ones, depending on your perspective).
As Omegacron reminds me in comments, Lumiya herself is an interesting version of this point; Lumiya had been trained by Darth Vader and served as an Emperor's Hand, a Force-sensitive assassin (Mara Jade was also one). Some time after the death of Palpatine and Vader, Lumiya just declared herself to be the new Dark Lady of the Sith.
Sith finds a way.