How to kill the Mockingbird

why does Atticus defend tom robinson if he himself acknowledges that they aren't going to win? Support your answer with evidence from the text.