A bruised rib is actually a healthy rib with some bruised muscle or tissues behind it. It is the result of a sharp blow to the ribcage. The rib is pressed back into the surrounding tissues, damaging them. Pain ensues.
The pain can range from mild discomfort to extreme agony, and has the disadvantage of hurting more whenever you move your ribcage. Breathing has a disturbing tendency to move the ribcage, which can make every minute a forced choice between deep pain or suffocation. Not fun. Other things that can aggravate a bruised rib include moving and lying down. This is an excellent time to pull a comfortable chair up to your computer and do some gentle noding.
But first you should see a doctor. Sharp pains in the chest area can indicate many serious problems, including but not limited to heart attacks, pleurisy, costochondritis, and broken ribs. If you are lucky enough to be diagnosed with nothing worse than a bruised rib, you will probably be told to ice it for 48 hours, take an anti-inflammatory medication (such as Ibuprofen), and you may be given some very simple exercises to gently work the surrounding muscles. The best thing you can do is give your muscles plenty of time to heal without putting them under additional strain. Healing will probably take a few days, as you would expect with other bruises and muscle injuries.