This picture below probably depicts what most people imagine, for someone getting stuck in a real quicksand and has no one to help him. This is an obvious effect of the the movies portray. A sandy pit with a devilish sucking force pulling anyone and anything down to the bottom. Well its not!

Its basically combines clay, sand and salty water forming a mixture resembling a dense soup which behaves nothing like it. The fact which makes it dangerous is that vigorous motion while being stuck in it causes it to liquefy rapidly causing the sinking. After the initial liquefaction, sudden solidification makes getting out difficult. Enough inside details. Let's get out of it now.
Awareness is a very important. Venturing out in marshy areas with probability of quicksands should have you prepared with extra alertness and a strong stick or pole.
When you fall into remember one thing - you can never ever sink in completely in a quicksand. The density of this sandy mixture is such that you can float more easily on it than on water. It's the struggle which makes sinking hasten .The only tough part is getting out. For this you need to stay calm and preferably get that pole we talked about.
First try to spread out your body in all directions. The first thing you should try is laying on your back .This is easier when you had fallen leg first .If you had tripped and fallen with your head first in the sand your first reaction will be panic and desperate attempts to get it out with your hands on the liquid sand . This will only cause the head to sink deeper. Here you should instead try to hold your breath for a few seconds .The natural buoyancy of your body will gradually lift you up.
A pole helps here by allowing you get on your back .Don't let any friends standing nearby tug at you. Instead ask them to get a pole from somewhere. Vary the alignment of the pole behind your back allowing your legs which may have sunk deep. Align it to the spine for the best results. It will prevent your hips from sinking. Slowly move towards the nearest solid ground by wriggling your legs and sliding.
