The formation of a preheat zone ahead of the flame propagating from the closed end of a semi-infinite tube; which causes acceleration of the reaction front; is the basic physical mechanisms of deflagration-to-detonation transition. The transition occurs when the pressure elevation at the accelerating reaction front becomes high enough to produce strong pressure jump following by the shock capable of supporting detonation. The preheat zone ahead of the flame front can be formed either by the flame folding; when the influx of heat from the folded reaction zone increases temperature inside the fold. The flame folding may be induced either by the classical Darrieus-Landau instability; or by the interaction of the flame with turbulent eddies; or by the wake from the obstacles in the tube. The preheat zone ahead of the flame may also be formed due to hydraulic resistance of adhesive walls or by obstacles. The role of the flame folding induced by the Darrieus-Landau instability on the transition to detonation is illustrated by numerical simulations of premixed gas combustion spreading from the closed end of a semi-infinite; smooth-walled channel; where the instability may invoke nucleation of hot spots within the folds of the developing wrinkled flame; triggering an abrupt transition from deflagrative to detonative combustion. The mechanism of transition due to formation of a preheat zone by hydraulic resistance in a channel with adhesive and rough walls is discussed and confirmed by numerical simulation.