Does the novel end with an optimistic way?
The simple answer is "yes", but there are many reasons.
While this novel is a social commentary in many ways, at heart Harper Lee is telling a coming of age story. Scout is coming of age in a turbulent time, dealing with her own identity and her belief structure in a world that is discriminatory and prejudicial. As a protagonist, she does change. She becomes less volatile and more rational, more willing to accept the views of other. We see this first at "tea" with Aunt Alexandra, when she begins to accept the role of the female in society, and finally begins to appreciate her aunt. However, the most poignant moment occurs at the end, when Scout walks Boo Radley - Arthur Radley - home to his house. This man that once frightened her is now her protector and friend. As Scout stands on her porch, her intellectual development is apparent. Here is the text:
A boy trudged down the sidewalk dragging a fishing pole behind him. A man stood waiting with his hands on his hips. Summertime, and his children played in the front yard with their friend, enacting a strange little drama of their own invention. It was fall, and his children fought on the sidewalk in front of Mrs. Dubose’s. . . . Fall, and his children trotted to and fro around the corner, the day’s woes and triumphs on their faces. They stopped at an oak tree, delighted, puzzled, apprehensive. Winter, and his children shivered at the front gate, silhouetted against a blazing house. Winter, and a man walked into the street, dropped his glasses, and shot a dog. Summer, and he watched his children’s heart break. Autumn again, and Boo’s children needed him. Atticus was right. One time he said you never really know a man until you stand in his shoes and walk around in them. Just standing on the Radley porch was enough.
Scout has learned how to battle discrimination. She has learned to see the world through another's eyes. The Finch family has triumphed over the Ewell's, despite the death of Tom Robinson. Jem has found his iconic father to be a role model, and is well placed to follow in his footsteps. The justice system, in the form of Heck Tate, has played with events to prevent the inquisition of a sheltered man who fought only to protect two young children. And Scout, in the last page, is put to bed, happy and safe, by the father she loves. Lee certainly leaves readers with a sense of optimism.