Historical fantasy encompasses any fantasy set in the past. It especially applies to any work that takes the fantastic beliefs of the past and treats them as realities. The classic is “The Greek Gods are real entities, merely superhuman, and these characters are about to start finding that out.”
Historical fantasies, because the definition is about setting, overlap with a lot of other genres. For example, Victorian-set steampunk time-travel fantasies are also historical fantasies.
If an old author was writing about events in their own time, that’s urban fantasy or contemporary fantasy, even though it’s historical to us.
Some examples of historical fantasy are:
The Broken Sword by Poul Anderson.
Territory, by Emma Bull.
Traitor to the Crown: The Patriot Witch by C. C. Finlay, which could also be classed as alternate history.
Those Who Hunt the Night and Traveling With the Dead by Barbara Hambly are dark historical fantasies.
Druids, by Josh Langston and Barbara Galler-Smith.
The Temeraire series by Naomi Novik, dropping dragons into the Napoleonic Wars:
His Majesty’s Dragon
Throne of Jade
Black Powder War
Empire of Ivory
Victory of Eagles
Tongues of Serpents
The Crystal Cave, The Hollow Hills, The Last Enchantment and The Wicked Day by Mary Stewart, showing a magical but historical Arthurian world.
The Day of the Minotaur, Green Phoenix, How Are the Mighty Fallen, The Not-World, The Forest of Forever, Wolfwinter, The Weirwoods and most anything else by Thomas Burnett Swan. His specialty is not the Northern Thing, but the Mediterranean mythology, set amid Etruscans and Hebrews and Hellenes.
Lincoln’s Dreams by Connie Willis, which is somewhat unclassifiable but very much wrapped in history.
Stories where the author only sort of gestures at history, that are plainly anachronistic, don’t fit here. Often they’re heroic fantasy, like Lord of the Rings (the hobbits supposedly still existed in Ireland and the west of England, probably Wales) or the Conan stories, that take place in a forgotten history “before the seas drank Atlantis.”