Ergotamine and caffeine are combined in certain medications to treat migraines and cluster headaches. Ergotamine is an ergot alkaloid that narrows blood vessels in the brain, reducing the throbbing pain associated with migraines. Caffeine, a central nervous system stimulant, enhances the effects of ergotamine and aids in its absorption, leading to faster relief from migraine symptoms.