Linear and nonlinear stages of the instability of a plane detonation wave (DW) and the subsequent process of formation of cellular detonation structure are investigated. A simple model with one-step irreversible chemical reaction is used. The linear analysis is employed to predict the DW front structure at the early stages of its formation. An emerging eigenvalue problem is solved with a global method using a Chebyshev pseudospectral method and the LAPACK software library. A local iterative shooting procedure is used for eigenvalue refinement. Numerical simulations of a propagation of a DW in plane and rectangular channels are performed with a shock capturing WENO scheme of 5th order. A special method of a computational domain shift is implemented in order to maintain the DW in the domain. It is shown that the linear analysis gives certain predictions about the DW structure that are in agreement with the numerical simulations of early stages of DW propagation. However, at later stages, a merger of detonation cells occurs so that their number is approximately halved. Computations of DW propagation in a square channel reveal two different types of spatial structure of the DW front, "rectangular" and "diagonal" types. A spontaneous transition from the rectangular to diagonal type of structure is observed during propagation of the DW.