In To Kill a Mockingbird, Tom Robinson has been convicted of raping Mayella Ewell, despite Atticus defending him and despite the fact that he is innocent. Atticus is not surprised and the verdict was predicted. He reminds his children that, unfortunately, this is not the first time an innocent man has been wrongly convicted and it won't be the last. His humiliation of Bob Ewell, Mayella's father, is just too much for Ewell because, in his own mind, Atticus has ridiculed and humiliated him whereas actually Atticus has simply told the truth. His anger and his need to "have some kind of comeback" for what Atticus has said, is what has fueled his anger and he vows to get his revenge. Bob will later be found dead under suspicious circumstances.
Atticus recognizes Bob Ewell as a despicable person but still wants his own children to "stand in Bob Ewell's shoes a minute" and see Ewell's perspective. He reminds them that "his kind" always seek to satisfy their own prejudices. The trouble started when Ewell saw Mayella kissing Tom which, in a town like Maycomb County, is an inexcusable act between a black man and a white woman. Rather than suffer embarrassment if the townsfolk ever found out, Ewell accused Tom of rape in the hope of saving his own pride. The cost to society is immeasurable, especially as Tom has now been found guilty, perpetuating the injustice. However Atticus hopes that, having spoken out against Ewell, if Ewell threatens him rather than " that houseful of children out there," then perhaps Atticus can save Mayella from "one extra beating," in which case, Atticus will "gladly take it."
Here is the film adaptation of Bob Ewell confronting Atticus about his representation of Tom Robinson: