Sideshow Bob calls local right-wing talk show host Birch Barlow and complains about being unfairly imprisoned. Barlow and Springfield‘s residents pressure Mayor Quimby into releasing Bob. Bob is soon unveiled as the Republican candidate for the Springfield mayoral election. Determined to keep Bob from becoming mayor, Bart and Lisa decide to campaign for Quimby. Unfortunately, due to Bob’s charisma and Quimby’s drowsy, overmedicated appearance at a televised debate, Bob wins the election by a massive margin.
Bart and Lisa begin to suspect that Bob somehow rigged the election. Lisa goes through the voting records but is unable to find any proof that the election was rigged. Lisa receives a message from Waylon Smithers telling her to find a voter named Edgar Neubauer, who will lead them to evidence of electoral fraud.
Eventually, Bart discovers the name Edgar Neubauer on a tombstone at the cemetery. Lisa then discovers that many of those listed as voting for Bob are long dead. At the trial that follows, they trick Bob into confessing his crime. The court strips Bob of his position and sends him back to prison, while Quimby regains his job as mayor.