How can I tell if I have a broken rib?

Chest X-Ray... Often you can suspect it by having pain with breathing. Broken ribs are usually caused by trauma of some sort (car accident, fights, falling, etc). The best test is an x-ray or ct scan to determine for sure. The treatment is usually just pain medication alone. Rarely is surgery used for broken ribs.
See a doctor. Most of the time, an xray and exam are sufficient to find rib fractures. The best way, however, is a ct scan, which shows the anatomy much better. Unfortunately it can be expensive and uses much more radiation.