What causes heartburn and how do you stop it with OTC meds?

Heartburn. Is caused by stomach acid that is exposed to the esophagus. OTC meds (antacids) in the two classes of H2 blockers (pepcid, zantac, etc) and PPI's (Nexium, Prevacid, Prilosec, Protonix, (pantoprazole) etc.) can stop heartburn. PPI's work best first thing in the morning, and H2 blockers work best at night. You need to take them daily for them to be most effective.
Acid. Acid / stomach contents refluxing into the esophagus. Omeprazole or any of the h2-receptor antagonists such as ranitidine.