Front/back matter

Tables of contents
A table of contents is produced with the \tableofcontents command. You put the command right where you want the table of contents to go; LaTeX does the rest for you. A previous run must have generated a .toc file.
The \tableofcontents command produces a heading, but it does not automatically start a new page. If you want a new page after the table of contents, write a \newpage command after the \tableofcontents command.
The analogous commands \listoffigures and \listoftables produce a list of figures and a list of tables (from .lof and .lot files), respectively. Everything works exactly the same as for the table of contents.
The command \nofiles overrides these commands, and prevents any of these lists from being generated.

\addcontentsline
The \addcontentsline{ext}{unit}{text} command adds an entry to the specified list or table where:
ext 	The extension of the file on which information is to be written, typically one of: toc (table of contents), lof (list of figures), or lot (list of tables).
unit 	The name of the sectional unit being added, typically one of the following, matching the value of the ext argument:
toc 	The name of the sectional unit: part, chapter, section, subsection, subsubsection.
lof 	For the list of figures.
lot 	For the list of tables.
entry 	The text of the entry.
What is written to the .ext file is the command \contentsline{unit}{name}.

\addtocontents
The \addtocontents{ext}{text} command adds text (or formatting commands) directly to the .ext file that generates the table of contents or lists of figures or tables.
ext 	The extension of the file on which information is to be written, typically one of: toc (table of contents), lof (list of figures), or lot (list of tables).
text 	The text to be written.

Glossaries
The command \makeglossary enables creating glossaries.
The command \glossary{text} writes a glossary entry for text to an auxiliary file with the .glo extension.
Specifically, what gets written is the command \glossaryentry{text}{pageno}, where pageno is the current \thepage value.
The glossary package on CTAN provides support for fancier glossaries.

Indexes
The command \makeindex enables creating indexes. Put this in the preamble.
The command \index{text} writes an index entry for text to an auxiliary file with the .idx extension.
Specifically, what gets written is the command \indexentry{text}{pageno}, where pageno is the current \thepage value.
To generate a index entry for ‘bar’ that says ‘See foo’, use a vertical bar: \index{bar|see{foo}}. Use seealso instead of see to make a ‘See also’ entry.
The text ‘See’ is defined by the macro \seename, and ‘See also’ by the macro \alsoname. These can be redefined for other languages.
The generated .idx file is then sorted with an external command, usually either makeindex (http://mirror.ctan.org/indexing/makeindex) or (the multi-lingual) xindy (http://xindy.sourceforge.net). This results in a .ind file, which can then be read to typeset the index.
The index is usually generated with the \printindex command. This is defined in the makeidx package, so \usepackage{makeidx} needs to be in the preamble.
The rubber length \indexspace is inserted before each new letter in the printed index; its default value is ‘10pt plus5pt minus3pt’.
The showidx package causes each index entries to be shown in the margin on the page where the entry appears. This can help in preparing the index.
The multind package supports multiple indexes. See also the TeX FAQ entry on this topic, http://www.tex.ac.uk/cgi-bin/texfaq2html?label=multind.