Quicksand is a colloid hydrogel consisting of fine granular matter (such as sand or slit), clay, and salt water. In the name, as in that of quicksilver (mercury), "quick" does not mean "fast," but "living".
After an initial disturbance—such as a person attempting to walk on it—the water and sand in the quicksand separate and dense regions of sand sendiment form; it is because of the formation of these high volume fraction regions that the viscosity of the quicksand seems to increase suddenly. Someone stepping in it will start to sink. In order to move within the quicksand, a person or object must apply sufficient pressure on the compacted sand to re-introduce enough water to liquidfy it.
How to get out of quicksand?
Drop everything. Because your body is less dense than quicksand, you can't fully sink unless you panic and struggle too much (which will cause the sand to further liquefy) or you're weighed down by something heavy. If you step into quicksand and you're wearing a backpack or carrying something heavy, immediately take off your backpack or drop what you're carrying. If it's possible to get out of your shoes, do so; shoes, especially those with flat, inflexible soles create suction as you try to pull them out of quicksand.
I saw this video on youtube and thought I'll just put it here. It's about a tour guide teaching people how to get out of quicksand.