I have tried looking for videos that explain the importance of standing up while riding, but haven't found any! This is pretty basic information, but IMO something that gets missed sometimes. I've gotten better, but now & again I find myself sitting mostly due to tired legs.
Basically, whether you're riding in deep, sandy whoops or over rocky, loose singletrack it's always a good idea to be standing on the pegs. This way the bike can move underneath you and you have control of the bike by moving your body side to side or back and forth as needed. Your legs become a part of the suspension and by standing, the bike works with you. If you try riding difficult terrain while sitting down, the bike is going to buck you all over, it will wear you out quickly and there's a chance you'll pile it up after getting bucked off the seat! Siting down makes the bike work against you and will wear you out faster!
Another thing that relates is foot position on the pegs... you're best off riding with the balls of your feet directly on the pegs. This lets your ankles act as your body's suspension in addition to the rest of your legs and keeps your toes out of harms way. When you need to shift and brake, move your foot forward.
One last thing while I'm thinking about it... something I picked up from our recent Moab ride. Climbing BIG ledges.. sometimes you can't loft the front wheel before a big ledge. One thing I picked up was leaning back as far as I could, stretching my arms out and stay on the throttle, taking weight off the front end. The front end won't deflect as much and if you keep your momentum and line, you'll go right up!