This is a good question. In fact, one of my favorite places in the book is a conversation that Atticus has with Scout. Scout asks if they will win the trial, and Atticus says no. Scout then asks why they should even bother. Atticus offers a noble point of view. Here is the dialogue:
“Atticus, are we going to win it?”
“Simply because we were licked a hundred years before we started is no reason for us not to try to win,” Atticus said.
Jem and Scout definitely learn that doing what is right will be hard and that they will have to cut against the grain and stand alone at times. As the trial grows nearer, they see firsthand the difficulties, such as when they realize that there was a mob that was going to harm Tom and even Atticus.
At the outset of the trial there are also many instances of racism. Some people of the town speak badly about Atticus and even at school the children poke fun at them.