It was produced on Karn as water from underground springs passed through the rocks heated by the Sacred Flame (which was prone to the generation of sooty residue) directly below them. The rocks contained rare minerals and compounds which were released into the water when heated.
A goblet was placed below the flame to catch the Elixir. Apart from the Sisterhood, only the Time Lords knew of the Elixier, until the Time Lord Morbius betrayed the secret so he and his followers could gain immortality. The Fourth Doctor pointed out the Time Lords only used it in rare cases, otherwise their life would be eternal and without any progress.
It could also be used to heal serious injuries, or even (at least in some circumstances) resurrect the dead. Time Lords occasionally used it when undergoing difficult regenerations. The Sisterhood used it to heal the Fourth Doctor after his mindbending battle with Morbius. (TV: The Brain of Morbius)
With special preparation, a variant of the Elixir could trigger a Time Lord's regeneration if they were injured too severely to regenerate normally. This variant could also influence both the physical and personality traits of the new incarnation. After the Eighth Doctor died in a spaceship crash on Karn during the Time War, the Sisterhood revived him long enough for him to consume one of a number of prepared Elixir that would enable him to select the personality, appearance and even gender of his next incarnation; he ultimately selected one that would return to him to life as a warrior. (TV: The Night of the Doctor)