Atticus defends Tom Robinson, no matter how difficult it is, because it is the right thing to do. We can say that Atticus is a man of integrity, honesty, and courage. In fact, right from the beginning, Atticus knows that he will lose the case in a town as racist as Maycomb. He clearly says this when Scout asks if they are going to win. Here is the quote:
“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.
In connection with this point, this is how Atticus defines courage—the ability to commit to what is right even in the face of certain or near certain defeat. Here is what he says to Jem:
I wanted you to see what real courage is, instead of getting the idea that courage is a man with a gun in his hand. It’s when you know you’re licked before you begin but you begin anyway and you see it through no matter what. You rarely win, but sometimes you do. Mrs. Dubose won, all ninety-eight pounds of her.
Atticus, therefore, defends Tom Robinson. That he considered the cost is evident, because he defends him in the face of a mob. He was willing to give his life. Fortunately for us, Atticus gives us his inner thinking on the topic:
“For a number of reasons,” said Atticus. “The main one is, if I didn’t 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."
“You mean if you didn’t defend that man, Jem and me wouldn’t have to mind you any more?"
“That’s about right.”