The theme of a piece of literature is what you get when you ask the question, "Beyond the plot, what is this work about?"
Themes can be developed in many ways. The simplest description of "theme development" is repeititon. When an idea comes up repeatedly or a certain type of decision is forced upon characters multiple times, we begin to see the ideas at work behind the plot. These ideas constitute the theme(s).
We wouldn't say that there is a "purpose in using theme", usually. Unless the theme is specifically political or oriented by a pointed concept, the theme will be better understood as a complex or wide-ranging idea that is expressed and explored in a work.
For instance, the major theme in Waiting for Godot is that humans can never reach outside of the finite realm of the human mind to grasp the meaning behind the world or to encounter ultimate, existential knowledge.
The theme is developed through dialogue that discusses an off-stage character attributed with certain qualities and it is developed through discussion of the arbitrary and chaotic meaninglessness of the present characters' situations.