How do characterization and setting contribute to a story's or poem's overall theme?
This is a great question. Characterization, setting and plot all have a profound effect on a poem or story. For one thing, these set up reader expectations.
The best way to illustrate this is through one of the most famous works in Western literature, Sophocles's Oedipus Rex.
Right from the opening scene, we can tell that the story is going to be one that is filled with tragedy. We see the suffering of the city of Thebes and the pain of the people. There is a plague and it eats away at the city. This setting sets the stage. In other words, it directs the mind of the reader to expect the worst.
Characterization also direct the expectation of the reader. When we see Oedipus enter into the work, we quickly realize that for all his courage and intelligence that he is powerful to help his people. Moreover as we see the tragedy unfold, we begin to get the feel that that he is part of the problem. At the end, our worst fears are confirmed. Oedipus's pride all along led to his downfall.
In short, setting and characterization have a huge role in reader expectation.