Yes there is one main trick, and some regular skills.
The trick is: if you LOWER THE TIRE PRESSURE, any tire will float over sand like magic.
It should not be so underinflated as to allow easy pinch flats, but the lower the pressure, the more marked the floating effect.
There are just two limitations:
If the tire is skinny (low volume)
it might not be possible to have a pressure level that allows flotation AND safe riding over rough terrain on other trail sections;
It's not possible to adjust tire pressure "on the fly" ;o)
But if you know you're having a long stretch of soft terrain, it's possible to have a good trade-off.
Anyway, huge tires (2.3 +) are perfect for that (watch this Surly Pugsley video).
Also, knobby doesn't help that much, sometimes slicks are better; they cause less shearing of the sand and rob you of less kinetic energy.
Now the skills are mostly help maintain speed and direction.
Speed:
not so fast as to suddenly throw you over the bars in case of loss of control, not so slow that your rear wheel loses traction in order to maintain or recover speed.
Direction:
plan ahead the smoothest possible trajectory, and point your front wheel firmly along that trajectory.
Avoid wobbling on the pedals, major gear changes, and specially avoid sharp turns, because there is a critical steering angle above which the front tire skids sideways and the bike becomes unstable, making it almost impossible to regain control in some cases (of course the more skill one has, the more one can recover from).
Hope that helps and...
PRACTICE!
Few things can be more fun than that!
bicycles.stackexchange.com/users/2355/heltonbiker
I have personally ridden and raced on many sandy courses and trails (e.g. Moab) and the best advice is to shift your weight back, relax and think about guiding rather than steering the bike.
You will never be able to ride in a perfectly straight line, so get over it or avoid sand.
Rather you need to let the bike move and shift around under you.
You will need to stay loose and relaxed while making sure to have a firm grip.
You can't force the bike or it will skid out.
Rather your job is to look ahead and guide the bike in the general direction you want to go.
You also need to avoid sudden jarring movements.
If you have ridden in dry snow, the feeling is quite similar.
I know some answers said avoid excessive speed (which is good advice for riders new to sand)
but I will say it is also possible to scream along on sand.
I have hit deep and long sandy sections at full speed before (e.g. 50km/hr) and been fine.
Sure the bike moved around a bit, but as long as I don't panic (and tighten up), kept my weight back and guided the bike I was fine.
If you are riding uphill or on the flats try to keep steady power on the pedals as you have less traction to work with.
Some find a faster or slower pedal cadence easier - try both and take your pick.
Also make sure to conserve momentum, if you slow down to much you won't be going anywhere.
Finally, don't get discouraged, riding on sand is a learned skill and always work to Lastly, there are also technical aspects (e.g. tire pressure) that have already been covered (heltonbiker)
bicycles.stackexchange.com/users/4534/Rider_X
I have plenty of experiance in insanely soft sand.
Before you leave : 29er, wide tyres, low pressure.
BUT Low preasure costs when you get back onto hard stuff, as do insanely wide tyres.
I set the bike up to go well on the hard stuff, and pay the price on the soft sections.
On the track : Riding style is Weight Back, Very high cadence, great balance and steer with weight shifts rather than handlebar movement.
It VERY quickly becomes faster, easier and more efficent to dismount and run/carry bike.
The only reason to ride soft sand to prove you can and get fit fast.
If the tracks are mostly soft sand (and you are like me - out to have fun), find better tracks, as it's not much fun after the novelty wears off.
One big advantage, it's a soft landing when it all goes wrong
bicycles.stackexchange.com/users/3924/mattnz
Riding on sand is pretty easy once you get the hang of it, keep yourself heavy on the front of the bike through technical dh sections and over the back on a low gear on climbs, when riding on sand around corners (especially deep sandy sections) avoid leaning into the corners too much and don't be afraid to counter steer with the bars, just don't do it too quick or you will be jerked off, try not to ride the brakes too much especially when going around corners or you could easily get bogged, stay loose and ride the smoothest, straightest line.
bicycles.stackexchange.com/users/32720/Lachlan
Fatter tires and stand up.
If you stay seated, the front tire will not be able to carry its weight and basically float, making it really hard to control.
Growing up on the beach in Hawaii, I have had my fair share of riding in sand and found that the wet sand that the ocean just saturated is 30 times easier to ride on than dry sand.
bicycles.stackexchange.com/users/3949/BillyNair
I have been trying to ride on some trials that have very soft sand and especially agitated by ATVs.  When I hit a soft patch my front tire pulls in one direction and I freak out a little.  I cannot seem to plow through it and ultimately just end up moving slower and slower, which than leads to a full stop.  Is there some trick or style to riding on these trails?
What is the trick to riding on sand?
bicycles.stackexchange.com
<mountain-bike><technique><riding-position>
bicycles.stackexchange.com/questions/10262
bicycles.stackexchange.com/users/3380/Carson Reinke
The trick is: if you LOWER THE TIRE PRESSURE, any tire will float over sand like magic. That said, big wide tires are better. With regard to riding style, it is beter to sit back, relax and guide the bike rather than steer it.  Riding on sand is pretty easy once you get the hang of it, keep yourself heavy on the front of the bike through technical dh sections and over the back on a low gear on climbs, when riding on sand around corners (especially deep sandy sections) avoid leaning into the corners too much and don't be afraid to counter steer with the bars, just don't do it too quick or you will be jerked off, try not to ride the brakes too much especially when going around corners or you could easily get bogged, stay loose and ride the smoothest, straightest line. A lower tyre pressure and thicker tyres will help the tyre to 'float' over sand. Keep a steady cadence without sharp changes in speed or direction. Keep your weight back and stay loose and relaxed. Use your weight to steer, not the handlebars. Plan ahead, keep a smooth, straight line and gently guide the bike. Riding on sand is a learned skill, so keep practising and get used to the surface.
A lower tyre pressure and thicker tyres will help the tyre to 'float' over sand. Keep a steady cadence without sharp changes in speed or direction. Keep your weight back and stay loose and relaxed. Use your weight to steer, not the handlebars. Plan ahead, keep a smooth, straight line and gently guide the bike. Riding on sand is a learned skill, so keep practising and get used to the surface.