Harper Lee uses Scout as a vehicle to ask the kinds of innocent questions that make Atticus explain why he is defending an African-American man, Tom Robinson, in simple and honest terms. For example, Scout asks Atticus, "Do all lawyers defend n-Negroes, Atticus?” She at first thinks that defending an African-American person is something to be ashamed of, like running an illegal still, because people in town are criticizing Atticus for doing so. Instead, Atticus explains to her in terms that a child can understand that defending Tom is the ethical and right thing to do. He tells her that if he didn't defend Tom, "I couldn’t hold up my head in town, I couldn’t represent this county in the legislature, I couldn’t even tell you or Jem not to do something again.” In other words, he explains to her in an easily comprehensible way that defending an African-American person is not only not evil but is part of being ethical and moral.
Scout's questioning allows Atticus to explain in simple terms why racism is wrong and why everyone deserves a fair trial. Scout asks the kinds of innocent questions that a child encountering racism for the first time would naturally ask, and Atticus's answers explain why he thinks she should reject society's racism and choose fairness and decency instead.