In the philosophy of Plato, Forms (or Ideas) are abstract, perfect, unchanging concepts that constitute what is ultimately real. The objects that we see in the world around us—the world of time and space—are but copies of some higher, deeper reality. In other words, they are copies of the Forms rather than the Forms themselves. As such, an investigation of the spatio-temporal world cannot provide us with the truth. Only a rational comprehension of the Forms can do that.
Plato illustrates this point with his famous allegory of the cave. The men who have been chained up their whole lives in the cave can only see the shadows of men appearing on the wall. As they have never seen actual men before, they take the shadows for the reality.
This is the position that most people—i.e., people who are not philosophers—take in relation to the spatio-temporal world. They look around them and see a world of objects, which they unthinkingly regard as constituting what is ultimately real. But in truth, they are only seeing the shadow of some higher reality—the reality of the Forms. Just as the men chained up in the allegory of the cave mistake shadows of men for men themselves, so the vast majority of humankind mistakes the world of objects for what is ultimately real.
The "Allegory of the Cave" is a section of Book VII of Plato's Republic, consisting of lines 514a to 520a. It is an "allegory", meaning that it is an extended narrative that describes an imaginary situation in order to create an extended analogy to something the author feels cannot be discussed directly in an effective manner.
In this allegory, Plato is trying to explain the nature of the forms, their relationship to phenomena, and why humans cannot directly apprehend noumena. He creates an analogy of a group of prisoners living in a cave who cannot see the outside directly but only see the shadows cast on the walls by the fire shining on various objects. The prison, for Plato, is analogous to the human body. Just as prisoners cannot go outside to see objects directly, so humans trapped in corporeal bodies cannot directly apprehend the forms. Instead, the soul, before it descends into the body, and after death, is capable of direct perceptions of the forms when it no longer is limited by human senses.
For Plato, phenomena are like flat, two-dimensional shadows of of the forms (or "noumena" or "ideas"). What we see as "red" or "good" or "a cat" is only a meager and poor imitation of the essence of redness or goodness or catness.
The Theory of the Forms is a key part of Platonic idealism. For Plato, reality is grounded in a still higher realm of universal truths, which we, trapped in our material existence, can only access indirectly. While we might have an idea of justice, beauty, or goodness, for example, Plato argues that these are not constructs invented by human beings or human societies. Rather, they are fundamental aspects of reality that come down to us from that still higher reality represented by the Forms.
As far as the Allegory of the Cave is concerned, the allegory itself is an illustration of Plato's model of reality. Thus, Plato gives an image of prisoners chained together in a cave. They are trapped, with their faces pointed toward the wall. A fire burns behind them (providing light). Meanwhile, there are others in the cave with puppets, projecting shadows for them to see. For the prisoners, these shadows are reality as they experience it.
From here, Plato imagines one of the prisoners becoming free, ascending upward from the cave, and emerging into the light of the sun. For Plato, this upward journey out from the cave and into the world illustrates the relationship between human existence and that still higher reality of the Forms. Compared to the realm of abstract universal truths, our own material existence amounts to only shadows.
The allegory of the cave is probably the most famous of all the passages in the Republic. It is used to show the difference between the world of senses and the world of forms. Forms are immutable and timeless, unlike what we see/feel/sense in the actual world, which are shadowy, unreliable reflections of their Forms. Plato believes that humans can never really see the Forms, but there are some that are able to apprehend them more clearly than others.
The allegory he uses in the cave is that the prisoners who are chained to the wall and forced to watch the shadowy figures and scenes that can be seen through a curtain—the shadowy figures (which we know are not real) become their view of reality.
If a prisoner was released and forced to see the "real" world as we know it, the brilliance of it would be painful and difficult for the prisoner to understand. At first, the man would want to return to the cave and the comfort of his own reality, but once he became used to it, he would eventually realize that he had been living a life of illusion in a world in which he didn't even know that the sun existed. He may go back and try to teach his fellow prisoners about his new reality, but if he attempted to release them to experience what they would see as madness, they would try to kill him.
Plato uses this allegory to explain why philosophers are so often mocked: they have had a glimpse of the Forms, and the people to whom they are trying to explain those ideas find them incomprehensible. Most people are stuck in the shadowy world of the senses, like the prisoners in the cave.