There is no prescribed way to write an essay or dissertation. The structure of any piece of written work will depend on the specific question which has been set or the questions which you have formulated for yourself, and on the envisaged content of your answer to that question.
Nevertheless, there are certain elements which are common to most essays or dissertations on most subjects:
It is important to organise the work around a clear, focused question. Present a coherent argument on a clearly defined issue, making use of a select body of relevant material.
Formulate a clear hypothesis or set of hypotheses (i.e. proposed explanation/s for the phenomena studied). Show how these hypotheses are related to the question asked, and why the research undertaken, the material used, etc. are relevant to them.
Your theme has to be situated in the context of existing bibliography. Give an analytical overview of relevant work. Be selective, accurate and critical. Explain the importance of your own piece of work (particularly in the case of the dissertation) in this context: for example, a new aspect uncovered, an attempt at a new explanation, a comparison between two different effects of the same problem, or a critical reappraisal of a number of positions in the argument examined.
If there is an aspect of the question that you feel is important but were not able or did not want to study, say so and explain why (this need not take more than a paragraph or so).
The introduction and the conclusion are vital for setting out your research question and methodology and for presenting your conclusions. You may find it helpful to write these last.
Finally, two general pieces of advice: be clear and interesting. Write on what you know and really intrigues you, not about what you feel you should study or about what you have very little interest in. This is especially true of the dissertation, on which you will usually spend between two and three months of intensive research.