In Harper Lee's To Kill a Mockingbird, the main reason why Atticus agrees to defend Tom Robinson is because Atticus is certain of Robinson's innocence and knows Robinson deserves the chance to be defended, despite the likelihood of still being condemned by the jury.
The certainty of Robinson's innocence is first revealed during the trial. Sheriff Heck Tate, Bob Ewell, and Mayella Ewell all testify that Mayella had been bruised on the right side of her face, something only a left-handed man could have accomplished while facing her. Yet, Mayella's testimony reveals the impossibility of her having been hit on the right side of her face by Robinson. During Mayella's testimony, Atticus has Mayella point to the man she is accusing of raping her. When she points to Robinson, Atticus has Robinson stand. All the court can see that Robinson's left arm is crippled, as Scout describes in her narrative:
[Robinson's] arm was fully twelve inches shorter than his right, and hung dead at his side. It ended in a small shriveled hand, and from as far away as the balcony I could see that it was no use to him. (Ch. 18)
Reverend Sykes then explains to Jem and Scout that Robinson's arm has been crippled ever since he got it caught as a boy in Mr. Dolphus Raymond's cotton gin. Prior to Mayella's testimony, Atticus also has Bob Ewell write his name before the court, proving that Ewell is left-handed or, as Judge Taylor points out, ambidextrous. Hence, Atticus has very deftly proven to the court that only Ewell was physically capable of bruising Mayella's face on her right side.
Even prior to the trial, Atticus showed his faith in Tom Robinson's character and trust in his innocence. When asked by Scout why he is defending a Negro, one of Atticus's replies is to explain that Robinson is a "member of Calpurnia's church" and that Calpurnia testifies they are "clean-living folks" (Ch. 9). Both of these facts testify to Robinson's strong and virtuous character. Hence, it can be said that Atticus took the case because he was certain of Robinson's good character and innocence.