For a description of what goes on inside TeX, you should consult The TeXbook by Donald E. Knuth, ISBN 0-201-13448-9, published jointly by the American Mathematical Society and Addison-Wesley Publishing Company.
For a description of LaTeX, you should consult "A Document Preparation System: LaTeX" by Leslie Lamport, ISBN 0-201-15790-X, published jointly by the American Mathematical Society and Addison-Wesley Publishing Company.
Every LaTeX file starts with a preamble which is followed by the body. The preamble is a collection of commands that specify the global processing parameters, such as paper format, heigth and width of the text, automatic page heads and footlines. As a minimum, the preamble must contain the \documentclass command to specify the document's overall processing type This is normally the first command in the preamble.
The preamble is followed by the body which starts by \begin{document} and ends with \end{document}. This is the end of the file as well.
The general syntax of a LaTeX file is as follows:
\documentclass[options]{class}
Further optional global commands and options,
such as \usepackage{packagename}
\begin{document}
text mixed with typesetting commands
\end{document}
NOTE: LaTeX is case sensitive. Enter all commands in lower case unless explicitly directed to do otherwise.