I’m actually currently doing some work in bear country, and had to take several bear safety classes prior to being allowed out in the field. @Winters has actually got it backwards. You are supposed to play dead in a brown/grizzly bear attack, and not a black bear attack.
The basic premise is this: If you are walking along, and surprise a bear, they may perceive you as a threat, and charge to attack. Most of the time it is a bluff charge, and they will break away at the last second. So, you are supposed to hold your ground and speak to the bear in a calm, but assertive voice. If the (brown) bear does attack, you should lie flat on your stomach, with your hands interlocked behind your neck to offer some protection to your head. Often times the bear will stop after a few seconds when it has determined that you are not a threat.
If the bear does not stop after 5 seconds or so, you should begin to fight like crazy, focusing your attacks on the bears sensitive nose and eyes. If a black bear attacks, you should always begin fighting. They are more aggressive to humans, especially when startled. Playing dead will not aid you against a black bear.
And, you never run from a bear (or any other predator). It will almost guarantee an attack, and all bears are faster then a human could ever want to be. It doesn’t matter what the terrain is, if you run from a bear, you will lose.