The mare in nightmare is not a female horse, but a mara, an Anglo-Saxon and Old Norse term for a demon that sat on sleepers' chests, causing them to have bad dreams.
Dialect variants, as explained below, include the forms mara, mahr, mahrt, mårt, and others.
In High German, the demon who causes bad dreams is most often called an Alp, a word that is etymologically related to elf.
A mare-induced bad dream is called a nightmare in English, martröð (mare-ride) in Anglo-Saxon and Icelandic, mareridt (mare-ride) in Danish, mareritt (mare-ride) in Norwegian, and Alpdruck (alp-pressure) orAlptraum (alp-dream) in German.
Some people have laid a hackle [an iron-toothed comb for the preparation of flax] on their bodies in order to keep alps away, but an alp often turns it over, pressing the points into the sleeper's body.
If you don't move your chair before going to sleep, the mare will ride it during the night. They like to give people hair-snarls (called whole-grain braids or mare braids), by sucking on their hair then braiding it.
Source: Jacob and Wilhelm Grimm, Der Alp, Deutsche Sagen (1816/1818), no. 81.