Focus stacking, also known as z stacking or depth of field blending, is a technique that combines multiple images focused at different planes, to obtain a greater depth of field. This is particularly useful in situations where the scene has a large range of depths in the subject space compared to the shallow depth of field obtained for a given sensor size, focal length, and aperture combination. This is often so in macro, landscape, and architectural work.
It is important to recall that for every single, non-stacked, image there is one (and only one) plane in the subject space at which the image points on the sensor are exactly sharp, that is, point like. Any point of a subject in another plane will be imaged as a disk, know as the blur spot. If this disk is sufficiently small for a given magnification and viewing distance, it will be indistinguishable from a point. The diameter of a sufficiently small blur spot is known as the acceptable circle of confusion. The acceptable sharpness between two planes on either side of the focal plane is known as the depth of field (DoF). These planes are always at right angles to the sensor plane unless we explore view cameras or use tilt/shift lenses on DSLRs.