Botchan (young master) is the first-person narrator of the novel. He grows up in Tokyo as a reckless and rambunctious youth. In the opening chapter he hurts himself jumping from the second floor of his elementary school, fights the boy next door, and tramples a neighbor's carrot patch by wrestling (sumĹ style) on the straw that covers the seedlings. His parents favor his older brother, who is quiet and studious. Botchan is also not well regarded in the neighborhood, having a reputation as the local roughneck. Kiyo, the family's elderly maidservant, is the only one who finds anything redeeming in Botchan's character.
After Botchan's mother passes away, Kiyo devotes herself fervently to his welfare, treating him from her own allowance with gifts and favors. Botchan initially finds her affection onerous, but over time he grows to appreciate her dedication, and she eventually becomes his mother figure and moral role model.
Six years after his mother's death, as Botchan is finishing middle school, his father falls ill and passes away. His older brother liquidates the family assets and provides Botchan with 600 yen before leaving to start his own career. Botchan uses this money to study physics for three years. On graduating, he accepts a job teaching middle school mathematics in Matsuyama on the island of Shikoku.
Botchan's tenure in Matsuyama turns out to be short (less than two months) but eventful. His arrogance and quick temper immediately lead to clashes with the students and staff. The students retaliate excessively by tracking his every movement in the small town and traumatizing him during his 'night duty' stay in the dormitory.
Mischief by the students turns out to be just the first salvo in a broader web of intrigue and villainy. The school's head teacher (Red Shirt) and English teacher (Uranari) are vying for the hand of the local beauty, and two camps have formed within the middle school staff. Botchan struggles initially to see through the guises and sort out the players. After several missteps, he concludes that Uranari and the head mathematics teacher (Yama Arashi) hold the moral high ground in the conflict. Red Shirt, who presents himself as a refined scholar, turns out to be highly superficial and self-serving.
As the story progresses, Red Shirt schemes to eliminate his rivals. He begins by having Uranari transferred to a remote post on the pretext of furthering his career. Next he uses a contrived street brawl and his newspaper connections to defame both mathematics teachers (Botchan and Yama Arashi) and to force Yama Arashi's resignation.
Botchan and Yama Arashi realize that they cannot beat the system, so they scheme a way to get even. They stake out Red Shirt's known haunt, an inn near the hot springs town, and catch him and his sidekick Nodaiko sneaking home in the morning after overnighting with geisha. With his usual eloquence, Red Shirt points out that they have no direct proof of any wrongdoing. Botchan and Yama Arashi overcome this technicality by pummeling both Red Shirt and Nodaiko into submission on the spot.
After dispensing justice with his fists, Botchan drops a letter of resignation into the mail and immediately heads for the harbor. He returns to Tokyo, finds employment, and establishes a modest household with Kiyo. When Kiyo passes away, he has her respectfully interred in his own family's grave plot.

Question: What do Botchan and Yama Arashi do to Red Shirt and Nodaiko?
Answer: Beat them into submission. 
Alternative answer: get even; catch them sneaking around after being with geisha and hit them until they confessed