what are the causes of heartburn

Heartburn is actually a symptom of GERD (gastroesophageal reflux disease), and is caused by acid refluxing back into the esophagus. Risk factors include those that increase the production of acid in the stomach, as well as structural problems that allow acid reflux into the esophagus.

Some common foods that we eat and drink, stimulate increased stomach acid secretion setting the stage for heartburn. Over-the-counter medications also may precipitate heartburn.

Examples of these irritants include:
aspirin (Bayer, etc.),
buprofen (Motrin, Advil, Nuprin, etc.)
Naproxen (Naprosyn, Aleve)
carbonated beverages,
acidic juices (grapefruit, orange, pineapple)
acidic foods (tomatoes, grapefruit, and oranges), and
Smoking and the consumption of high-fat content foods tend to affect function of the lower esophageal sphincter (LES), causing it to relax from the stomach and allow acid to reflux into the esophagus.

A hiatal hernia where a portion of the stomach lies within the chest instead of the in abdomen, can affect the way the LES works and is a risk factor for reflux. Hiatal hernias by themselves cause no symptoms. It is only when the LES fails that heartburn occurs.
Pregnancy can cause increased pressure within theabdominal cavity and affect LES function and predispose it to reflux.
Obesity may also cause increased pressure in the abdomen, and thus reflux in the same way.
Primary diseases of the esophagus can also present with heartburn as a symptom. These include, among others, scleroderma and sarcoidosis.