The mood of David Copperfield shifts depending on what is going on in David's life at the time, but overall the novel encourages the reader to feel sympathetic and cautiously optimistic.
Early on, David perseveres through many tragedies and injustices, but there are nonetheless bright spots in his life. Peggotty, for instance, is a caring mother figure for him, and she introduces him to her extended family, who will remain important figures in David's life. By the time David goes off to school at Salem House, the reader is invested in his well-being and has a paternalistic sense of whose company he should seek out (the Peggotys', if possible) and whose company he should avoid (Mr. Murdstone's and people like the waiter who manipulates him into giving up his food).
By introducing foils such as Steerforth and Uriah Heep, the novel keeps the reader sympathizing with David even when he makes poor choices, such as marrying Dora. When he makes this bad decision, readers might feel that he's old enough to know better, and this might cause them to sympathize with him a bit less. In contrast with truly ill-intentioned characters, though, David looks more like a young fool than a bad actor. The adult narrator's self-awareness about his younger self's foolishness further serves to keep the reader hoping for David's good fortune. He seems always to be doing his best and trying to develop his moral character, and the adult narrator provides a peek at the kind of person he will eventually become if readers are patient.
The novel ends incredibly optimistically. David has a seemingly perfect family with Agnes. The narrator even avoids describing it in too much detail so it can remain perfect. Everyone still living has overcome tragedy and adversity remarkably well, and David seems to believe that his entire life has worked out for the best. He even imagines seeing Agnes's face just before he dies and goes to heaven. Even though Dickens critiques certain aspects of social life in Victorian England, the overall mood of the novel suggests that Dickens really believes happy endings can happen there for people willing to persevere through adversity. This lighthearted mood might be a bit of wish-fulfillment on Dickens's part. As a semi-autobiographical novel, David Copperfield seems to provide not only the reader but also Dickens with the hope that his future looks bright.