Anywhere it wants to, really. A short story or novel can retell a specific folkloric story (e.g. the tale of Cinderella or the myth of Amaterasu), or it can make use of folklore within the setting, or it can invent something new modeled on the elements of those styles.
Hmmm — style. I have a theory about that, a Marie Brennan original. (If somebody else has proposed this before, I’m not aware of it.) My theory is that, looking at it stylistically, modern fantasy fiction is more often like legends than any other kind of folklore.
Of those three core types, legends are the closest to what we expect out of fiction nowadays. Instead of the abstraction and flatness of folktales and myths, legends present a degree of depth, of realism. Even if the events happening in them are fantastical, they’re presented as a part of the world we live in. Ghosts in the castle, faeries under the hill, restless corpses buried at crossroads. And because these things are part of our world, they follow something like the logic we know, and evoke the reactions we expect. No real person would ever blithely cut off their own finger and use it as a key to open a door at the base of a glass mountain, but if you or I were to be stolen away for a hundred years, we would indeed come back to find everyone we knew is dead, and that would be a horrifying thing. Which is exactly the kind of story a legend tells.
Even when we’re not discussing urban fantasy — a topic that deserves, and will get, its own post — I think the tone of most fantasy is legendary. The balrog lurks in the depths of Moria, and the Fellowship of the Ring fights it and runs from it. The people of Westeros build a great wall and place a guard on it to protect themselves from the monstrous Others on the far side. Human beings have daemons in animal form, and the society they live in shapes itself to accommodate that fact. This isn’t the rarefied, origin-of-things air of myth, nor the simplified focus of a folktale, which doesn’t concern itself with the consequences of its weird elements. It fits into the world around it, just as legends fit into our own world. Fantasy merely takes that a few steps further.
The reason for this is that the vast majority of modern fiction is expected to meet a certain minimum standard of verisimilitude, both on a natural and personal level. We look for plausibility: do we believe the world could operate that way, if the right base conditions were altered? Do we believe people could behave that way? We value interiority, the sense that we know the character’s mind and can ride along inside it. Folktales and myths don’t offer us that entry point, not unless we crack them open and start building something inside. And when we do that, when we apply the standards of modern fiction to them, we start making them more like legends.
This is, in a sense, separate from the issue of content. You don’t have to be retelling an actual legend, or making use of the creatures from one, for the similarity to be there. It’s a question of how you choose to approach your content. There’s fantasy out there which doesn’t take this approach — Narnia being a famous example, and in some ways The Hobbit as well — but the trend of the genre has been quite strongly in this direction. Enough unrealism to be fantasy, but not so much as to lose our engagement.
Why do I bring this up? Because I think it’s useful to pay attention to what it is we’re doing, both so we can do it more effectively, and so we can know when and why to leave the pattern behind.