After Atticus presents the evidence and all the witnesses have spoken, Jem is certain that Tom Robinson will be acquitted.
The evidence clearly speaks to Tom's innocence. Mayella's injuries were unlikely to have been dealt by Tom because of his disability. Mayella's story is evasive and Bob Ewell's testimony also suggests that he is lying. Tom's testimony works to prove his innocence, but the response to some of his remarks (regarding feeling sorry for Mayella) show the adults in courtroom that racial bias is still strong in the community.
Jem is shocked and hurt when his confidence in the outcome is rebutted by a guilty verdict. Jem expected to see justice done and instead he sees an obvious injustice take place.
Both Jem and Scout come to realise that life is not always fair, that good does not always triumph over evil.