Atticus is optimistic about human nature almost to the point of naivete, and honest to his very core. He believes deeply that a man is only as good as his word, and he takes his role as a father very seriously. When he makes it clear he plans to do his best to defend Tom Robinson, one of the reasons he gives is that he couldn't look his children in the eye if he felt he hadn't done the right thing. However, at the end of the novel, when it becomes apparent that disclosing who killed Bob Ewell would mean placing Arthur (Boo) Radley in the path of more psychological harm, he acquiesces to Heck Tate. Heck says that Bob Ewell fell on the knife that killed him; at first Atticus is adamant that the truth will be told, because he thinks that Jem killed Bob, and he will not be part of a coverup, even if it involves his own son. However, when Tate makes him understand that it was actually Boo who killed Ewell and saved the children's lives, Atticus gives in, thanking Boo for his children's lives. He asks Scout if she can possibly understand, and she says she can, that it would be kind of like shooting a mockingbird.
These last pages of "Mockingbird" always make me cry. That has nothing to do with the question you answered, but I believe this is quite possibly the loveliest story I have ever read.
This question has already been asked and answered right here on eNotes. Here are a couple of links for you: