Call it the mythology of the story, call it lore, it's all the same thing really. In fantasy, at least for me anyway, it's probably one of the most important part of the story. Personally I like the term "lore" and since this is my post, that's what we're calling it. It would be easy to confuse this with world-building and, to a certain extent it is a part of effective world-building, creating a backdrop against which the novel plays out.
In Peter V. Brett's Demon Cycle it's the myths and legends telling of the time when the demons were first driven back to the core. With Rothfuss it's the tales of the Chandrian and of Lanre, in Raymond E Feist's Riftwar Saga, I suppose it's the legends of the Valheru. What it isn't is the geography or economics, or even the politics of a place. Lore is all about myth and half-remembered fables.
We're funny creatures us readers. Rules are not universally applicable. Whilst we might accept an info-dump in terms of lore, it would never work with a character's past for example. How this lore is conveyed to the reader is a damn tricky thing. There was a time when you could do this by way of a prologue. David Edding's Belgariad did this and, as a reader in my early teens, it didn't bother me at all. Either fantasy as a genre has moved on a little since then, or I've grown older (I said older, not up. Growing up is a foolish thing for any man to attempt, we're simply not qualified.) In any event, a prologue like this seems clumsy and cumbersome now, unless done very well.
Rothfuss conveys a LOT of his lore by way of songs and stories within his books. I've tried to do the same thing, though most of the lore conveyed turns out to be false.
The droos began as one such people. A people driven by the quest for understanding, to discover their place in this world and the starry skies above. They had no temples, no churches. They gave no Setday services, unlike our good priest.” He nodded towards the door Trallen had so recently stormed out of. “They spent their time, instead, in the study of all things, and of the secret workings of the world. The unseen flows of power that turn the seasons and lift the tides. Some say they succeeded in finding answers. Some say they discovered dark and terrible things, and this is how they shattered the moon.”
Samen, Fae - The Wild Hunt
Oddly creating lore, at least for me, is probably the easiest part of writing. It's when your imagination is let loose on the page and anything can happen. Without lore then, we as readers, would never know that accepting rings from Sauron is probably a bad idea, or that Valyria is not going to make a top holiday spot any time soon.
Writing about these myths and legends within the story is also a case of less is more. These are the areas where it's okay to leave the reader hanging. My whole series is about myths and the truth that lurks within them. It's about half-forgotten fragments and lost histories. Give me your imagination to play with and together we can go somewhere special.
Fantasy has a foolish stigma that it's books for nerds or children. To this I say pah! (insert stronger words if you like,) Fantasy is by no means an easy thing to read, or to write. There is a reason fantasy novels tend to be longer than books in other genres, A good fantasy book has to create an entire world on top of a good story and engaging characters. Buried in amongst this will be the lore. It's a small thing but done correctly, it's the icing on the cake. Let me know if I did it right.