Now, a classic conceit of Science Fantasy is to have the "wonders of the ancients" be the products of a technological civilization, even ours ...
The kind of adventure scenarios that D&D-type games support best involve medieval-level technology people journeying to a lost, mysterious labyrinth, there to confront monsters and perils, and haul back wondrous artifacts and treasures. As some have noted, this encourages a background assumption of a fallen world, consistent with many of the source inspirations for D&D. In particular, Jack Vance's Dying Earth gives a well-reasoned background for magic, in which the "basic science" that allowed generation of new spells has been lost, leaving only an "applied science" of spells learned by rote - literally crammed into the brain!
Specifically, let's think of any technique or technology as having four elements:
Research: theoretical knowledge of the underlying phenomena generates new ideas;
Development: experimentation and testing creates new applications;
Engineering: specialist knowledge keeps the techniques running in a stable state; and
User Interface: the techniques are adapted for use by non-specialists.
In D&D, as in Vance, the Research stage has been lost - otherwise, the magic would look more like Ars Magica's theoretically coherent system. Wizardry in Vance is essentially Engineering, learning set spells at a great cost in training, and only rare and costly magic items present an easy User Interface. And D&D allows for spell research, but only by trial and error, typical of the Development layer cut off from Research.
|Golden Race: so old they used Myspace.|
On the user level, the most simple magical powers were coded into site-specific patches of color, as well as items, most of which are now lost or destroyed. More complicated procedures like medical regeneration required some degree of specialist knowledge and mental training.
For other people's games, the above analysis of technology provides an easy rebuttal to those who wonder why magic doesn't automatically lead to sorcerous streetcars and demonic dishwashers. If magic is confined to a guild where specialized knowledge is needed to wield it, then individual wizards may conjure up invisible butlers for themselves or for the masters they serve, but the lack of an large Engineering class means that magic never becomes an institution. Without the engineers of magic, its phenomena are confined to the lab and testing grounds.
Think of the analogy in technological fiction; it's no coincidence that the typical pulp techno-villain is someone who has hatched an advanced technique of mass control or destruction in isolation. The only thing distinguishing the D&D wizard from the Bond villain is the flavor of handwavium needed to explain their wondrous deeds.