One of the things I've always tried to do is take a look at the way D&D rules work and tried to adapt my world to fit those assumptions. That doesn't mean that I won't alter or houserule something that doesn't jibe with some setting detail that I'm particularly attached to, but I'm not interested in changing 30 plus years of D&D tropes unless I have a darn good reason. Better to flex my world to fit the rules.
Cleric magic has always struck me as a good example of this kind of strangeness. With a few exemptions, clerics and magic-users (wizards, mages, whatever you want to call them) cast spells pretty much the exact same way. I think we can all agree that the D&D cleric is primarily based on the idea of a medieval Christian crusader, perhaps with some extra powers (i.e. spells) tacked on from various mythological and literary sources. Nowhere that I've read, however, do miracles work like D&D magic. So how do they work, why, and what does that mean for a D&D campaign setting?
Conclusion #1: Despite the difference in source and effect, cleric spells and magic-user spells are just different categories of the same kind of thing.
The magic used by clerics, for almost all purposes, is the same as the magic used by wizards. I know that the spells themselves are different, that's not what I'm saying. Cleric spells are not miracles. They don't reflect the way the biblical prophets performed signs and wonders. The only thing that cleric spells seem to be simulating is magic-user spells, at least in terms of preparation and execution. In fact, in the original D&D rulebooks (1974), there is no clear rule saying that only wizards keep spellbooks. The rules seem to imply that both clerics and magic-users both collect their spells in books (Men and Magic, p.34).
Conclusion #2: The force that powers spells comes from somewhere outside of the caster. Cleric spells come from a deity.
All magic comes from an external source. Magic-users study strange writings in ancient tomes to somehow temporarily “memorize” spells. Clerics pray to a god or goddess, also gaining a set number of one-shot spells. In both cases, the spell comes from somewhere else, gets held within the spell-caster's mind until used, and then it's gone. While it is not clear where magic-user spells actually come from (the cosmos, the energy of all living things, who knows?), such is not the case for clerics; their magic comes from the gods. Some D&D books make reference to clerics who gain their spells from some concept, such as Law or Nature, which for these purposes is the same as a deity.
Conclusion #3: Something intangible separates cleric and magic-user spells.
Despite the similarities between the two types of magic, clerics cannot cast magic-user spells and vice versa. The game rules don't offer any explanation for this, other than the idea that the spells come from different sources. There is something of an idea that perhaps wizard spells are written down differently than cleric spells. While clerics don't use spellbooks in most versions of D&D, they do make and use scrolls. However, clerics lack the spell Read Magic, which magic-users need to decipher spellbooks, scrolls, and the like. That seems to imply that a cleric spell is simpler than a magic-user spell, but requires a deity to function.
Conclusion #4: There are a finite number of cleric spells.
Magic-users must find and “learn” all their spells. If they haven't personally copied it into a spellbook, they can't prepare it. Furthermore, a given magic-user is limited by his intelligence, meaning that he can never learn all the spells in the world. Clerics do not suffer this limitation; they can pray for literally any spell that exists (limited by their experience level). However, they can't just ask their god for whatever they want. A cleric must choose from a set list of established spells.
Furthermore, it doesn't matter what deity a character follows, he has access to the same exact spells as every other cleric (at least, in original D&D). That means that a priest of the thunder god has the same powers as a priest of the goddess of love. Third Edition changed this a little bit with the advent of Cleric Domains, but all clerics still have access to the same core set of spells
From the above conclusions, I came up with the following setting assumptions.
Assumption #1: There is a list of cleric spells
If a cleric must prepare spells from a set list, it is reasonable to assume that this list of available spells is somehow written down. Since all gods grant the same spells, then this list either predates the current religions, is somehow shared by them, or each had developed it independently (perhaps with divine inspiration).
Assumption #2: Cleric spells are simple rituals
All it takes to cast a magic-user spell is intelligence and special training. Cleric spells are presumably easier since they require no spellbook or a very high intelligence. However, only someone with faith in a deity and a certain amount of wisdom can cast them.
Assumption #3: Only the ordained can cast cleric spells
If cleric spells are written down, simple, and only require faith, then any pious, literate person should be able to cast them. This is not the case, however. Only clerics can employ these spells, with a god or goddess providing the final, unknown component that triggers the magic. While it's plausible to say that a deity actively approves the casting of each and every spell, checking whether or not the caster is a cleric of sufficient power and piety, this seems like a weak answer to me.
A better solution is to assume that clerics, by their affiliation with a structured religious order, undergo a ritual that gives them the power to use their magic. Whatever means a specific religion uses to ordain its clergy, the act of ordination lets the priest transform a list of simple prayers into powerful magic spells.