The camera focuses in bands and the closer an object is to you camera's lens, the narrower the depth of field (or the band) becomes. This is where focus stacking comes in. Using a tripod for stability, you take multiple images of the same subject, slowly moving your band of focus from the front to the back of the scene. It usually takes 8 to 15 images to cover the entire scene.
You then take the images into Photoshop. With two magic clicks of the mouse, Photoshop aligns and blends the images, selecting what it thinks is in focus in each one. Ideally, you come away with an image that is in focus from the front to the back. Sometimes, Photoshop has trouble identifying areas of sharp focus. In which case, the photographer can go in and make corrections.
There are other softwares more capable of focus stacking, but when using Photoshop, it's critical to chose the right subject. Using books as a background proved useful, since the program could easily latch on to the areas of sharp text. When focus stacking is successful, its presence shouldn't be obvious.












