If you're hiking in a forest, whether flatland or mountainous, you may encounter a black bear. An estimated 300,000 of them inhabit 41 of the lower 48 states, from coast to coast. To survive an encounter with a black bear, hike with a group and be prepared. Wear medium hiking boots and carry a backpack with a quick-access pocket on the hip belt. Carry bear spray there. Bear spray contains capsaicin, but it's a different concentration than spray for people. Make sure it specifies it's for bears.
"Black" bears can be black, cinnamon, golden, and in some parts of British Columbia, even white. These bears are generally shy, and prefer to avoid contact. If you see a bear, and it hasn't seen you, back away slowly. Watch the bear but don't make eye contact. When you're out of sight, wait until you hear it move away or find a route around it. Bears have very poor eyesight, so if it sees you, wave your arms slowly, and talk in a calm voice to let it know you're human. Move slowly upwind away from the bear. Never walk up to a bear, and never try to feed it.
In some situations, a bear may see you as a threat. If it's a mother with first year cubs, she'll start a defensive attack. She'll warn you by swatting the ground or chuffiing, moaning, and snapping her teeth. If she approaches you, stand still. She'll usually stop, and then you can back away and pull out your bear spray. If she comes at you again, use the spray when she's within 15 feet, and aim for the face. You'll also be perceived as a threat if a bear is defending a kill. Watch for ravens and other scavengers that may indicate a kill site, and avoid it.
If the bear attacks defensively, play dead, and the bear should leave. If it attacks you aggressively, fight for your life with all your might. Yell, use a knife, fists, or sticks and rocks, and aim for the nose and eyes. As soon as you can get away, head for medical help. If you're far from help, first treat any bleeding wounds with your first aid kit.
Use good bear sense, and survive for your next hike.
(Sources: http://www.wcs.org/globalconservation/northamerica/adirondacks-test/adirondackbear/46902170, http://www.gov.mb.ca/conservation/wildlife/problem_wildlife/bbear_encounters.html, http://www.mountainnature.com/Wildlife/Bears/BearEncounters.htm, http://ext.nrs.wsu.edu/publications/Blackbears1.htm )