For some reason, modern fantasy literature and gaming seems to have a burning need to explain how the magic works. Most D&D worlds have one or more dieties of magic that make it work. Some form of magical "field" that envelops the world is common, as are "mind magics" which are simply psychic powers and thaumaturgy, having a lot of magical and/or spiritual beings on your rolodex. There's certainly nothing wrong with explaining the whys of the magic of one's world, but neither is it necessary: Tolkien certainly didn't need to explain to us why magic worked in Middle-earth; it simply did.
What is necessary to explain is why so many different intelligent races live together on one world and what exactly the demi-human races are. Referees who do not take the time to work out such details will invariably get the "humans with pointy ears" syndrome that plagues many a world. Those that do, those who can succinctly explain what makes elves, dwarves, and halflings different from humans in their world, will find their players far more ready to embrace the role of playing a truly non-human character.
There are four basic origins for human/demi-human mixtures on a world: Parallel evolution, gateways, fairyland, and magical mutation. As we look at each of these possibilities, we should note that they are not mutually exclusive. Middle-earth, for example, had elves, humans, ents, dwarves, and halflings individually created by Illuvatar and/or the Valar, but also saw Morgoth magically mutating elves into orcs, ents into trolls, etc. as he waged war on all that was good. There's no reason the referee should not do the same in his own world.
This entry could just as well be termed "parallel creation," since many fantasy worlds presume that the mortal races are the creation of the powers-that-be. This origin is the most common in pulp fantasy (with gateways coming in at a close second), which often features decadent remnants of a once-great species that ruled before man evolved from monkey. Howard's Hyborian Age was rife with such throwbacks, as are the stories of Michael Moorcock and Fritz Lieber, but as noted, Tolkien also had parallel creation as a central theme in his Middle-earth.
In such worlds, mankind tends to be the dominant species, with the elder races having passed their zenith and on their way to extinction, and the overall tone of such a world tends to be a bit bleak, either mourning the passage of an Age of Legends or taking for granted the eventual fall of Man and the rise of an inhuman successor. On the other hand, properly done, such a world impresses the reader/player with its yawning abyss of time, leaving a world littered with the corpses and ruins of many ages.
In some worlds, such as the Forgotten Realms, Planescape, or Andre Norton's Witchworld, the backstory includes an ancient race of powerful wizards (or technologists) who left behind a great network of gates linking the world to many other worlds, and through which the inhabitants, flora, and fauna of those worlds game to the main one of the story. In such a world, the original dominant species may have died out or moved on, or else their civilization may have fallen and their descendents may live on as just one of many races. These worlds tend to be wonderful hodgepoges, where a knight might ride his horse next to an elf riding a chocobo, and there's no reason for humans to be dominant except within their own kingdoms. In Katherine Kerr's Deverry novels, for example, humans dominate the titular kingdom and the island nation of Bardek, but the elves, dwarves, and other races all have their kingdoms in the surrounding lands where they can ignore the humans most of the time.
A "gateway" world makes for good gaming, since it becomes easy to explain the existence of so many strange monsters in close proximity to each other and offers pleny of opportunity for plane-hopping for groups that like that sort of thing. Interestingly, the Realm of the Dungeons & Dragons cartoon was just such a world, with the unaired finale strongly suggesting that not only the kids, but everyone in that world had been pulled to it through a gate originally.
Where a gateway world has numerous portals to many worlds (most of which are suggested to be just other planets like our own earth), a world with a realm of Faerie is chiefly defined by the dichotomy between the natural world and the faerie world. This kind of world is exemplified by Poul Anderson's Three Hearts and Three Lions, and in a modern twist, in Mercedes Lackey's Serrated Edge novels.
The World of Greyhawk was implied by the Dungeon Master himself to be somewhere between this and the gateway world. In Oerth, humankind is the natural and native race, with elves, dwarves, halflings, and gnomes coming from some other world, which is why they are restricted to small pockets around the edges of human civilization (e.g., around the Lortmill Mountains)--humanity has a few thousand years of head-start and the advantage of being on their native soil, so to speak.
Whether Faerie is actually another world or is a natural part of the game world that just happens to only manifest where the Law of civilization doesn't reach is a matter for the referee to decide.
At first glance, this would seem to be just another form of parallel evolution, but where the former sees the various races as having been created by the powers-that-be from the ground up or having evolved naturally over eons, creatures shaped by magical mutation were transformed very suddenly either by some magical chaos or by the deliberate experimentation of some powerful being. We've already cited the creation of orcs from elves in Middle-earth; the creation of trollocs and myrdrall in Robert Jordan's Wheel of Time series would be another example (this time by a mad scientist rather than by a god).
Not all such mutations result in evil beings, however. In Mercedes Lackey's Valdemar novels, many good as well as evil or just dangerous beings were transformed in the magical cataclysm that nearly destroyed the world in the series' backstory. In one trilogy, we meet a young woman who was transformed by magic into a cat-girl for the pleasure of a powerful and evil adept--but she herself is by no means evil. Jack Chalker's Changewinds trilogy shows just such a magical cataclysm and its effects on those caught up in it in action.
MY OWN CAMPAIGN
My original concept for the campaign world was based heavily on the Faerie concept, and I'm importing a modified form of that into the Kingdoms of Kalamar. Officially, KoK presents a world of parallel evolution, with the elves, dwarves, and other races having all had their day in the sun and now having retreated before the onslaught of the nations of men--and with the very strong possibility that man will be replaced by the hobgoblins in time. In my campaign, however, elves aren't just long-lived humanoid beings, but creatures of Faerie and Chaos who are subject to strange moods and stranger motives. Dwarves aren't just short men with beards, but anthropomorphic personifications of the roots of the world. Gnomes and halflings have never had empires of their own, but are deeply connected to the Fey, who live in hidden dells and beneath the roots of the great forests that still remain.
The PCs will have to decide for themselves whether they are aligned with the Law of Man, pushing back the wilderness; whether they will ally themselves with Chaos, trying to tear down the Kalamaran Empire; whether they seek some kind of balance; or whether they are simply unaligned and out for personal fortune.
Whichever side they choose, those playing demi-humans won't be allowed to play humans with pointy ears, but will have to stretch themselves into looking at the world in a new and alien way.