How do you tell if pain is from a sinus infection or from a bad tooth?

Dentist. If you think you may have a bad tooth, see your dentist. He or she can tell you if the pain is from a tooth or likely from a sinus infection.
It is hard to tell . Many people complain of tooth pain when having sinus issues...Especially the top middle teeth because their roots are near the maxillary sinuses. If you get tooth relief from over the counter sinus medications, it is probably your sinus but only a doctor or dentist can tell you for sure. It is important to get a dental exam every 6 months as dental infections can become deadly.
Antihistamine. Generally if the whole side of your mouth hurts, ie- multiple teeth - it might be a sinus infection. Try an antihistamine like Benadryl (diphenhydramine) that is over the counter and if your symptoms get better it is probably the sinus and you should see your physician and if it doesn't go away and starts to localize to a tooth see your dentist.
See your dentist . Your dentist can take xrays and examine your teeth. They can detect if there are any problems with your teeth. If no problems then it may be due to the sinuses. Your ENT will evaluated you and do a ct scan.