In a nutshell, it's done with a special lens.
The how:
Tilt-shift photography refers to the use of camera movements on small- and medium format cameras. In many cases, it refers to tilting the lens relative to the image plane and using a large aperture to achieve a very shallow depth of field.
“Tilt-shift” actually encompasses two different types of movements: rotation of the lens, called tilt, and movement of the lens parallel to the image plane, called shift. Tilt is used to control the orientation of the plane of focus, and hence the part of an image that appears sharp. Shift is used to control perspective, usually involving the convergence of parallel lines.
The what:
A tilt-shift lens allows the photographer very exacting control over the depth-of-field in an image, much more than any regular lens could provide. Focus can be restricted to a single, narrow band, with everything else rapidly blurring away.
This distorts the appearance and makes the eye think that distances are a lot smaller than they typically are. When applied to a large scene like a city or a museum, everything appears miniature.
Here's a great slideshow of sporting events with audio where the photog explains the process and why it works so well with that application.
Here's the funky lens: