Quicksand consists of clay, salt water and fine sand. In simpler terms, quicksand is simple sand so saturated with water that friction between soil particles has been reduced. Because of this, quicksand is unable to support any weight. Quicksand can be formed by upward motion of groundwater or earthquakes; both conditions push the soil particles apart and trap a large quantity of water in between. This leads to soil behaving more like a liquid than a solid and hence is unable to support weight.
In undisturbed conditions, the quicksand consists of soil particles suspended in water and appears like a solid. A minute disturbance causes this equilibrium to fail and the sand will act as a suspension. It has been estimated that even a 1% change in stress can cause the reduction in viscosity and an increase in downward motion of soil particles by a factor of a million. After this initial disturbance that reduces the viscosity, the sand particles and water separate, leading to formation of denser regions of sand sediments, which causes an increase in its viscosity. It is this increased viscosity of sediments that makes the motion through quicksand so difficult.
In simpler terms, when a person accidentally steps into quicksand, he disturbs the equilibrium and reduced viscosity will cause him to sink. However, the density of quicksand (~ 2 gm/cm^3) is more than the density of a human being (~ 1 gm/cm^3) and hence the person will not sink completely. But if the person struggles and tries to move around, the increased viscosity will mean that the person is unable to move and sinks further. To get out of quicksand, enough water has to be introduced so as to loosen the denser soil sediments (and thereby reduce the viscosity) and this can only be achieved by very slow and progressive movements, which will ensure that water flows and loosens the viscous sand regions.
Hope this helps.