The rule of thirds is a "rule of thumb" or guideline which applies to the process of composing visual images such as designs, films, paintings, and photographs. The guideline proposes that an image should be imagined as divided into nine equal parts by two equally spaced horizontal lines and two equally spaced vertical lines, and that important compositional elements should be placed along these lines or their intersections. Proponents of the technique claim that aligning a subject with these points creates more tension, energy and interest in the composition than simply centering the subject would.
The photograph to the right demonstrates the application of the rule of thirds. The horizon sits at the horizontal line dividing the lower third of the photo from the upper two-thirds. The tree sits at the intersection of two lines, sometimes called a power point or a crash point. Points of interest in the photo do not have to actually touch one of these lines to take advantage of the rule of thirds. For example, the brightest part of the sky near the horizon where the sun recently set does not fall directly on one of the lines, but does fall near the intersection of two of the lines, close enough to take advantage of the rule.
The rule of thirds is applied by aligning a subject with the guide lines and their intersection points, placing the horizon on the top or bottom line, or allowing linear features in the image to flow from section to section. The main reason for observing the rule of thirds is to discourage placement of the subject at the center, or prevent a horizon from appearing to divide the picture in half. Michael Ryan and Melissa Lenos, authors of the book An Introduction to Film Analysis: Technique and Meaning in Narrative Film state that the use of rule of thirds is "favored by cinematographers in their effort to design balanced and unified images" (page 40). 
When filming or photographing people, it is common to line the body up to a vertical line and the person's eyes to a horizontal line. If filming a moving subject, the same pattern is often followed, with the majority of the extra room being in front of the person (the way they are moving). Likewise, when photographing a still subject who is not directly facing the camera, the majority of the extra room should be in front of the subject with the vertical line running through their perceived center of mass.
The rule of thirds was first written down by John Thomas Smith in 1797. In his book Remarks on Rural Scenery, Smith quotes a 1783 work by Sir Joshua Reynolds, in which Reynolds discusses, in unquantified terms, the balance of dark and light in a painting. Smith then continues with an expansion on the idea, naming it the "Rule of thirds":
Two distinct, equal lights, should never appear in the same picture : One should be principal, and the rest sub-ordinate, both in dimension and degree : Unequal parts and gradations lead the attention easily from part to part, while parts of equal appearance hold it awkwardly suspended, as if unable to determine which of those parts is to be considered as the subordinate. "And to give the utmost force and solidity to your work, some part of the picture should be as light, and some as dark as possible : These two extremes are then to be harmonized and reconciled to each other." (Reynolds' Annot. on Du Fresnoy.)Analogous to this "Rule of thirds", (if I may be allowed so to call it) I have presumed to think that, in connecting or in breaking the various lines of a picture, it would likewise be a good rule to do it, in general, by a similar scheme of proportion; for example, in a design of landscape, to determine the sky at about two-thirds ; or else at about one-third, so that the material objects might occupy the other two : Again, two thirds of one element, (as of water) to one third of another element (as of land); and then both together to make but one third of the picture, of which the two other thirds should go for the sky and aerial perspectives. This rule would likewise apply in breaking a length of wall, or any other too great continuation of line that it may be found necessary to break by crossing or hiding it with some other object : In short, in applying this invention, generally speaking, or to any other case, whether of light, shade, form, or color, I have found the ratio of about two thirds to one third, or of one to two, a much better and more harmonizing proportion, than the precise formal half, the too-far-extending four-fifths—and, in short, than any other proportion whatever. I should think myself honored by the opinion of any gentleman on this point; but until I shall by better informed, shall conclude this general proportion of two and one to be the most pictoresque medium in all cases of breaking or otherwise qualifying straight lines and masses and groupes [sic], as Hogarth's line is agreed to be the most beautiful, (or, in other words, the most pictoresque) medium of curves.
Writing in 1845, in his book Chromatics, George Field notes (perhaps erroneously) that Sir Joshua Reynolds gives the ratio 2:1 as a rule for the proportion of warm to cold colors in a painting, and attributes to Smith the expansion of that rule to all proportions in painting:
Sir Joshua has given it as a rule, that the proportion of warm to cold colour in a picture should be as two to one, although he has frequently deviated therefrom; and Smith, in his "Remarks on Rural Scenery," would extend a like rule to all the proportions of painting, begging for it the term of the "rule of thirds," according to which, a landscape, having one third of land, should have two thirds of water, and these together, forming about one-third of the picture, the remaining two-thirds to be for air and sky; and he applies the same rule to the crossing and breaking of lines and objects, &c. 
Even at this early date, there is skepticism over the universality of such a rule, at least in regards to color, for Field continues:
This rule, however, does not supply a general law, but universalises a particular, the invariable observance of which would produce a uniform and monotonous practice. But, however occasionally useful, it is neither accurate nor universal, the true mean of nature requiring compensation, which, in the case of warmth and coolness, is in about equal proportions, while, in regard to advancing and retiring colours, the true balance of effect is, approximately, three of the latter to one of the former; nevertheless, the proportions in both cases are to be governed by the predominance of light or shade, and the required effect of a picture, in which, and other species of antagonism, the scale of equivalents affords a guide.
Smith's conception of the rule is meant to apply more generally than the version commonly explained today, as he recommends it not just for dividing the frame, but also for all division of straight lines, masses, or groups. On the other hand, he does not discuss the now-common idea that intersections of the third-lines of the frame are particularly strong or interesting for composition.