STL is a file format native to the stereolithography CAD software created by 3D Systems. This file format is supported by many other software packages; it is widely used for rapid prototyping and computer-aided manufacturing. STL files describe only the surface geometry of a three dimensional object without any representation of color, texture or other common CAD model attributes. The STL format specifies both ASCIIand binary representations. Binary files are more common, since they are more compact.
The Facet Normal
In both ASCII and binary versions of STL, the facet normal should be a unit vector pointing outwards from the solid object. In most software this may be set to (0,0,0) and the software will automatically calculate a normal based on the order of the triangle vertices using the 'right hand rule'. Some STL loaders (eg the STL plugin for Art of Illusion) check that the normal in the file agrees with the normal they calculate using the right hand rule and warn you when it does not. Other software may ignore the facet normal entirely and use only the right hand rule. So in order to be entirely portable one should provide both the facet normal and order the vertices appropriately - even though it is seemingly redundant to do so. Some other software (e.g.SolidWorks) use the normal for shading effects, so the "normals" listed in the file are not the true facets' normals.
Stereolithography machines are basically 3D printers that can build any volume shape as a series of slices. Ultimately these machines require a series of closed 2D contours that are filled in with solidified material as the layers are fused together.
The natural file format for such a machine would be a series of closed polygons corresponding to different Z-values. However, since it's possible to vary the layer thicknesses for a faster though less precise build, it seemed easier to define the model to be built as a closed polyhedron that could be sliced at the necessary horizontal levels.
The STL file format appears capable of defining a polyhedron with any polygonal facet, but in practice it's only ever used for triangles, which means that much of the syntax of the file is superfluous. It is also the case that the value of the normal shouldn't be necessary, since that is a direct calculation from the coordinates of the triangle with the orientation being controlled by the right hand rule.
STL files are supposed to be closed and connected like a combinatorial surface, where every triangular edge is part of exactly two triangles, and not self-intersecting. Since the syntax does not enforce this property, it can be ignored for applications where the closedness doesn't matter.
The closedness only matters insofar as the software which slices the triangles requires it to ensure that the resulting 2D polygons are closed. Sometimes such software can be written to clean up small discrepancies by moving endpoints of edges that are close together so that they coincide. The results are not predictable, but it is often sufficient to get the job done.
Obviously, there is much scope for "improvement" of this file format, which in its present form is nothing more than a listing of groups of 9 (or 12 if you care about the normals) floating point numbers embedded in some unnecessary syntax. Since each vertex is on average going to be used in six different triangles, considerable savings in memory could be obtained by listing all the points in a table at the beginning of the file, and concluding with a list of triangle definitions composed of triplets of integers that referenced this table.
However, for the purpose of generating a single contour slice using a very lightweight piece of software on a computer with little memory, this format is perfect since it can be processed in one pass regardless of file size.
Use in other fields.
Many Computer-aided design systems are able to output the STL file format among their other formats because it's quick and easy to implement, if you ignore the connection criteria of the triangles. Many Computer-aided manufacturing systems require triangulated models as the basis of their calculation.
Since an STL file output, of a sorts, is almost always available from the CAD system, it's often used as a quick method for importing the necessary triangulated geometry into the CAM system.
It can also be used for interchanging data between CAD/CAM systems and computational environments such as Mathematica.
Once it works, there is very little motivation to change, even though it is far from the most memory and computationally efficient method for transferring this data. Many integrated CAD and CAM systems transfer their geometric data using this accidental file format, because it's impossible to go wrong.
There are many other file formats capable of encoding triangles available, such as VRML, DXF, but they have the disadvantage that it's possible to put things other than triangles into it, and thus produce something ambiguous or unusable.