Braking often happens in a hurry. When you're on your game, reflexes take over and you intuitively apply the correct amount of front or rear brake to bring your conveyance back under control. But let us return to the absolute basics to build up the necessary skills for arresting your progress in style...
Show your bike you care by giving it heaps of attention. Remember to comment when it's looking especially nice, or has a new accessory... and most importantly don't be shy about grabbing each brake lever and observing whether it activates the front or rear brake. Most bikes (outside of North America) are set up with the front brake controlled by the right lever. When you're riding on the road or easy terrain consciously apply the front then rear brake. Eventually which-is-what will become etched into your memory and you'll be ready to explore the joys of stopping in anger.
Think about each brake independently. The general rules are simple - your front brake is your most powerful stopping tool. It delivers up to 70% of your braking power and is best used before a corner when you are still heading in a straight line. Jamming on the front brake while cornering can cause your front wheel to wash out or 'straighten up' your bike - launching you towards the first tree or other convenient obstacle you spy. Check out Going down on your bike and Braking and Descending.
The rear brake is mostly used in conjunction with your front brake to balance the stopping forces. You can drag on your back brake through a corner to keep your speed in check. Jamming it on mid-corner is guaranteed to lose traction and start skidding... not usually good technique but can be quite useful as a last resort to effect a quick change of direction. If it does all get a bit untidy then releasing the brakes as you exit the corner causes the bike to accelerate - instantly helping regain balance and control.
Friction from braking generates a lot of heat. Unless you are planning a post ride fry-up at the bottom of a hill then it pays to practise 'feathering' your brakes. Both rim and disc brakes will 'fade' as they heat up and will eventually give up all together if you cook them. Pumping your brakes on and off during extended descents lets you control your plummet while still retaining enough in reserve for when you really need to stop. This technique also stops your hands from getting pumped.
Paradoxically the secret of braking is knowing when not to brake - which is a lot more often than you think. Maintaining your momentum around corners saves you valuable pedalling energy and helps to keep your riding buddies off your tail. The trick is to correct your speed with punchier use of both brakes as late as possible. As soon as you spot the sweet line release the brakes, look around the corner, move your weight onto your front wheel and outside pedal... and carve that baby. The same applies when you hit a rough or rooty section of track. Look ahead to locate a nice smooth, grippy spot to brake on and then let the bike glide through the tricky stuff. Your suspension works better without braking so you have more control even though you're travelling faster. And you won't be adding to those shattering braking bumps caused by less skilled riders.
Correctly set-up brakes will deliver ample stopping power with just one finger on the brake lever. This lets you grip the handle bars firmly while braking at speed. Check that the pads have plenty of wear left in them and with rim brakes that they are sitting square on the rims.