In 1858 Texas, the Speck brothers, Ace and Dicky, drive a group of black slaves on foot. Among the shackled slaves is Django (Jamie Foxx), sold off and separated from his wife, Broomhilda von Shaft (Kerry Washington). The Speck brothers are stopped by Dr. King Schultz (Christoph Waltz), a German dentist-turned-bounty hunter from D端sseldorf, who asks to buy one of the slaves. He questions Django about his knowledge of the Brittle brothers, a group of outlaws for whom Schultz is carrying a warrant. Schultz, a superior gunslinger, immediately kills Ace with a Fast draw. King insists on honorably paying Dicky a fair price for Django before leaving him at the mercy of the newly-freed slaves, who kill him and follow the North Star to freedom. As Django can identify the Brittle brothers, Schultz offers him his freedom in exchange for help tracking them down. After tracking and killing the Brittles, the liberated Django partners with Schultz through the winter and becomes his apprentice. Schultz explains that he feels responsible for Django since Django is the first person he has ever freed, and felt morally obliged to help Django reunite with Broomhilda. Now fully trained, Django collects his first bounty, keeping the handbill for good luck.
In 1859, Django and Schultz travel to Mississippi, where they learn the identity of Broomhilda's owner: Calvin J. Candie (Leonardo DiCaprio), the charming but cruel owner of the Candyland plantation, where slaves are forced to fight to the death in brutal wrestling matches called Mandingo fights. Schultz and Django meet Candie at his gentleman's club in Greenville and submit their offer to buy one of his best fighters. Intrigued, Candie invites them to his ranch at Candyland. After secretly briefing the German-speaking Broomhilda, Schultz claims to be charmed by her and offers to buy her as well. During dinner, Candie's staunchly loyal house slave Stephen (Samuel L. Jackson) becomes suspicious of Schultz and Django's motives. Deducing that Django and Broomhilda know each other and that the sale of the Mandingo fighter is a ruse, Stephen alerts Candie and admonishes him for his greed. Candie offers an alteration of the original deal, with Broomhilda taking the Mandingo fighter's place at the same price, and threatens her death should the deal be rejected. Schultz agrees, and the papers for her freedom are drawn up and signed. Candie smugly insists that the deal be sealed through a handshake, which Schultz initially refuses. When Candie threatens again to kill Broomhilda, Schultz snaps and kills Candie with a concealed derringer. Candie's bodyguard Butch Pooch kills Schultz and Django kills him in turn, and an extensive gunfight begins. Django guns down a great number of his opponents, but surrenders when Broomhilda is taken hostage.
The next morning, Stephen tells Django that he will be sold to a mine and worked to death. En route to the mine, Django proves to his escorts that he is a bounty hunter by showing them the handbill that Schultz said was good luck from his first kill. He convinces them that there is a large bounty for criminals hiding at Candyland, and promises that they would receive the majority of the money if they free him. The escorts release him and give him a pistol, which he uses to kill them before stealing a horse and returning to Candyland with a bag of dynamite.
At the plantation, Django kills more of Candie's henchmen, takes Broomhilda's freedom papers from the dead Schultz's pocket, bids goodbye to his late friend and frees his wife from a nearby cabin. When Candie's mourners return from his burial, Django kills the remaining henchmen and Candie's sister Lara Lee Candie-Fitzwilly, releases the two remaining house slaves, and kneecaps Stephen. Django then ignites the dynamite that he has planted throughout the mansion, and he and Broomhilda watch from a distance as the mansion explodes with the incapacitated Stephen inside, before riding off together.

Question: How does Django earn his freedom?
Answer: By helping Schultz track down the Brittle brothers