Because the student has a limited amount of time and only a nervous and fallible memory to work with, instructors are much more lenient on exam essays than they would be on papers written at home. However, the principles of organization that govern any piece of written work still operate in an exam. You must still develop a thesis and stick to it. Some students panic in exam situations and produce garbled streams of information that demonstrate their capacity for memorization but fail to develop any kind of logical thought. Writing a very brief outline will help you avoid this pitfall.
Never lose sight of the question being asked. It is a good practice to include some of the key words from the question in your opening paragraph, and to return to it in your conclusion. The effect will be to make clear that you have indeed kept your answer on the topic.
Question the question:
The professor wants to see that you know the material well enough to make a critical judgement upon it, not that you can throw out a collection of unrelated details. The more information you are able to recall and use effectively the better, but always relate what you write to the thesis. A good question will allow you not only to demonstrate what you know but also to make an observation about it.
Many exam questions include a quotation that you are asked to discuss. "Discuss" does not mean "make sure that you agree with the quotation"; rather it opens the topic for exploration. It is likely that your thesis in response to the quotation will be to suggest a modification of it, rather than a slavish agreement with it. Whether you agree or disagree, be sure to support your position.