The James Webb Space Telescope will observe primarily the infrared light from faint and very distant objects. But all objects, including telescopes, also emit infrared light. To avoid swamping the very faint astronomical signals with radiation from the telescope, the telescope and its instruments must be very cold. Therefore, Webb has a large shield that blocks the light from the Sun, Earth, and Moon, which otherwise would heat up the telescope, and interfere with the observations. To have this work, Webb must be in an orbit where all three of these objects are in about the same direction. The answer is to put Webb in an orbit around the L2 point.
The L2 orbit is an elliptical orbit about the semi-stable second Lagrange point . It is one of the five solutions by the mathematician Joseph-Louis Lagrange in the 18th century to the three-body problem. Lagrange was searching for a stable configuration in which three bodies could orbit each other yet stay in the same position relative to each other. He found five such solutions, and they are called the five Lagrange points in honor of their discoverer.
In three of the solutions found by Lagrange, the bodies are in line (L1, L2, and L3); in the other two, the bodies are at the points of equilateral triangles (L4 and L5). The five Lagrangian points for the Sun-Earth system are shown in the diagram below. An object placed at any one of these 5 points will stay in place relative to the other two.
In the case of Webb, the 3 bodies involved are the Sun, the Earth and the Webb. Normally, an object circling the Sun further out than the Earth would take more than one year to complete its orbit. However, the balance of gravitational pull at the L2 point means that Webb will keep up with the Earth as it goes around the Sun. The gravitational forces of the Sun and the Earth can nearly hold a spacecraft at this point, so that it takes relatively little rocket thrust to keep the spacecraft in orbit around L2.
Other infrared missions have selected an L2 orbit, like WMAP, Planck, and Hershel. For a more detailed explanation of the Lagrangian points, please see the WMAP discussion of this orbit.
Here are a few graphics that illustrate how far away Webb will be. It will take Webb rough 30 days to reach the start of its orbit of L2.
(Note that these graphics are not to scale.)