Well, Bob officially "won" the court case, but everyone in that courtroom, if they were thinking straight, knew that he was a lousy scumbag that beat up his own daughter and blamed an innocent black man of raping her to cover it up. Atticus, through his questioning of Mayella and Tom, made it pretty clear that Tom was innocent, and that Bob was the no-good child abuser that was responsible for Mayella's injuries and Tom's arrest. So, even though the verdict was what Bob Ewell wanted, he felt that his reputation was ruined. His pride was injured. He felt exposed for the fraud that he was, and the way that a lot of people react to that is defensively. Bob blamed Atticus and the Judge (who wasn't very nice to him either) for making people in the town think poorly of him. It is easier to blame Atticus for framing him, and to try to pass his behavior off that way, than to accept the blame for what he did. So, he reacts by unleashing his revenge for having been so poorly mistreated by Atticus and the judge. He wants to vindicate his "honor". He is mad that they made him look so bad. And, he does; he sneaks about, spits on Atticus, and in the end, makes the very awful attack that is the dramatic end of the novel.