We present a unifying description of localized states observed in systems with coexistence of two spatially periodic states, called bi-pattern systems. Localized states are pinned over an underlying lattice that is either a self-organized pattern spontaneously generated by the system itself, or a periodic grid created by a spatial forcing. We show that localized states are generic and require only the coexistence of two spatially periodic states. Experimentally, these states have been observed in a nonlinear optical system. At the onset of the spatial bifurcation, a forced one-dimensional amplitude equation is derived for the critical modes, which accounts for the appearance of localized states. By numerical simulations, we show that localized structures persist on two-dimensional systems and exhibit different shapes depending on the symmetry of the supporting patterns.