Au contraire. We just need to define the question a little better.
Change: How do magic words work? to How are magic words understood to work by those who use them? Now we need cultural data.
If the question is “universally, for all reality,” the answer is “they don’t.” The scientific method has never been able to support a hypothesis claiming words have power to act independently.
Within specific cultures, there are a number of explanations. One popular use of magic words in contemporary America is prayer. Spoken words are addressed to a deity, who is the one that will carry out the required action. This is method can also be used as in Dr. Faustus to invoke a spirit who will carry out the summoner’s bidding (or eat him because he got a word wrong, or whatever). There are a number of different types of prayer. Sometimes the location is important (e.g. in a church); sometimes a gesture accompanies it (e.g. folded hands); sometimes the words are poetic or formulaic (e.g. rote prayers); sometimes they have other features to enhance their sacrality and thus their power (e.g. a sacred language like Latin or Hebrew; a source in the Bible).
Everyday folk magic often works by principles of sympathetic magic, for which you could do worse than read Frazer’s Golden Bough. Some magical acts are accompanied by charms, verbal performances which are supposed to cause magical actions. Sometimes these words describe the actions to be performed, echoing and amplifying the gesture. The Anglo-Saxon bee charm against swarming has the recited throw gravel at the swarming bees (kids: do not try this at home), and as the rocks fall to earth, so the bees will settle down. The charm describes this. Again, there is often poetry to this. Fantasy writers seem to all agree that magic spells should rhyme, and this is also found in folk tradition. Sometimes nonsense or foreign words are inserted here, too.
There’s also noa names, taboo words whose utterance can have negative consequences. Famously, the bear in many languages (e.g. Russian медведь myedvyed’ literally means ‘honey-eater,’ presumably because the inherited Indo-European bear word was just too scary. In Sanskrit it became the name of a kind of demon). Sometimes this is situational: pigs at sea are to be called “land-dolphins” [made-up example, sorry, but similar things are known], but at home you can call them pigs. This idea underlies the “bad words” we’re taught not to say in polite society.
I could go on, but the phenomenon has been extensively studied by folklorists, anthropologists, and linguists. Most communities who believe in magic words will have some of these features, but it really is strongly dependent on your culture’s ideas of magic and of poetry. As far as abstract reality goes, I’m afraid you won’t find an answer. Sorry.