The novel alternates between two settings. The first is 1930s Moscow, where Satan appears at the Patriarch Ponds in the guise of "Professor" Woland, a mysterious gentleman "magician" of uncertain origin. He arrives with a retinue that includes the grotesquely dressed valet Koroviev; the mischievous, gun-happy, fast-talking black cat Behemoth; the fanged hitman Azazello; the pale-faced Abadonna; and the witch Hella. They wreak havoc targeting the literary elite and its trade union MASSOLIT.[note 1] Its privileged HQ is Griboyedov's House and is made up of corrupt social climbers and their women (wives and mistresses alike), bureaucrats, profiteers, and, more generally, skeptical unbelievers in the human spirit.
The second setting is the Jerusalem of Pontius Pilate, described by Woland in his conversations with Berlioz and later echoed in the pages of the Master's novel. This part of the novel concerns Pontius Pilate's trial of Yeshua Ha-Notsri, his recognition of an affinity with, and spiritual need for, Yeshua and his reluctant but resigned submission to Yeshua's execution.
Part one of the novel opens with a direct confrontation between the unbelieving head of the literary bureaucracy, Berlioz, and an urbane foreign gentleman (Woland) who defends belief and reveals his prophetic powers. Berlioz brushes off the prophecy of his death, only to have it come true just pages later in the novel. The fulfillment of this death prophecy is witnessed by a young and enthusiastically modern poet, Ivan Ponyrev, who writes his poems under the alias Bezdomny ("homeless"). His futile attempt to chase and capture the "gang" and warn of their evil and mysterious nature lands Ivan in a lunatic asylum. There, Ivan is introduced to the Master, an embittered author, the petty-minded rejection of whose historical novel about Pontius Pilate and Christ leads him to such despair that he burns his manuscript and turns his back on the "real" world, including his devoted lover, Margarita.
Major episodes in the first part of the novel include a satirical portrait of the Massolit and their Griboyedov house; Satan's magic show at the Variety Theatre, satirizing the vanity, greed and gullibility of the new rich; and Woland and his retinue capturing the late Berlioz's apartment for their own use.
Part two of the novel introduces Margarita, the Master's mistress, who refuses to despair over her lover or his work. She is invited to the Devil's midnight ball, where Woland offers her the chance to become a witch with supernatural powers. This takes place the night of Good Friday, with the same spring full moon as when Christ's fate is sealed by Pontius Pilate and he is crucified in Jerusalem, which is also dealt with in the Master's novel. All three events in the novel are linked by this.
Learning to fly and control her unleashed passions (not without exacting violent retribution on the literary bureaucrats who condemned her beloved to despair) and taking her enthusiastic maid Natasha with her, Margarita enters naked into the realm of night. She flies over the deep forests and rivers of the USSR, bathes and returns with Azazello, her escort, to Moscow as the anointed hostess for Satan's great Spring Ball. Standing by his side, she welcomes the dark celebrities of human history as they arrive from Hell.
She survives this ordeal without breaking; and, for her pains, Satan offers to grant Margarita her deepest wish. Margarita selflessly chooses to liberate a woman whom she met at the ball from the woman's eternal punishment: the woman was raped and had later suffocated her newborn by stuffing a handkerchief in its mouth. Her punishment was to wake up every morning and find the same handkerchief lying on her nightstand. Satan grants her first wish and offers her another, citing that the first wish was unrelated to Margarita's own desires. For her second wish, she chooses to liberate the Master and live in poverty-stricken love with him.
Neither Woland nor Yeshua appreciates her chosen way of life, and Azazello is sent to retrieve them. The three drink Pontius Pilate's poisoned wine in the Master's basement. Master and Margarita die, though their death is metaphorical as Azazello watches their physical manifestations die. Azazello reawakens them, and they leave civilization with the Devil as Moscow's cupolas and windows burn in the setting Easter sun. The Master and Margarita, for not having lost their faith in humanity, are granted "peace" but are denied "light" — that is, they will spend eternity together in a shadowy yet pleasant region similar to Dante's depiction of Limbo, having not earned the glories of Heaven, but not deserving the punishments of Hell. As a parallel to the Master and Margarita's freedom, Pontius Pilate is released from his eternal punishment when the Master finally calls out to Pontius Pilate telling him he's free to finally walk up the moonbeam path in his dreams to Yeshua, where another eternity awaits.