Snakes are the only vertebrates which have efficiently overcome the handicaps of absence of limbs making them survive with relatively long, slender body and a cosmopolitan habitat bestowed on them by nature.
This achievement was basically by adopting different modes of locomotion fulfilling the need of environment in which the animal lives.
The most common mode of progression which is generally employed by all species and is characteristic to them is the serpentine type of locomotion better named as undulatory motion in which the animal forms a zig-zag track. The basic necessity for this type of motion is maximum resistance. The roughness in rocks, branches, dust, sand or pebbles resists the long slender body to move on a straight line, owning to which the body assumes a position of a series of s shaped horizontal loops or curves.
Each loop or curve which faces some resistance in turn delivers an equal and opposite thrust against the resistance leading to the formation of a series of lateral or horizontal waves, produced by a flow of muscular contraction and relaxation passing from head to tail, resulting in the propulsion of the body in the forward direction
This kind of zig-zag motions are undergone only when the surface is rough enough to offer maximum resistance. It is of no use when they move on a really smooth surface, where they are offered least resistance.