This is mainly referring to weapons in Dungeons & Dragons-style roleplaying games, but also fantasy literature given that magic weapons are staples of the genre.
In my Fantasy World Sketch, I suggested that magic would have altered human development significantly, primarily in the realm of food production. I didn’t go down the route of completely reimagining how societies would have developed, in part because I wanted to end up with something that resembled a “classic” fantasy milieu, but it seems clear to me that since food production is a priority for most species, magic would be used to improve it. Historically speaking, war is another important societal endeavor, and its import is clear in most fantasy realms—that is, the impact of magic on warfare is discussed at length and covered in the rules.
Those rules don’t get into real innovation, however. In truth, the kind of constant warfare found in most fantasy settings would produce tremendous incentive for disruptive inventions (magical, technological, or both) that would alter the face of warfare—or, at the least, produce constant struggles to gain minor advantages. Putting aside the likelihood of some mage-tinkerer figuring out how to mass-produce the equivalent of machineguns (something that would be too disruptive), there’s still room for tactical innovations that aren’t game-breaking developments. At some point, an enterprising warlord would attempt to outfit some of their units with magic weapons of some kind or another. These attempts would probably fail in terms of cost-benefit analysis, but some edge cases might not.
Their enemies would then try to counter the advantage. How? Answering that question is a lot easier if you know how the advantages provided by magic weapons actually work. That’s something the various game books, and most of the source material I’m aware of, are quite vague on.
In literature, it’s a little easier: the author only has to deal with the specific cases of the weapons they write about, and not the generalized cases produced by a bizarre adventurer-centric economy. Books also don’t have to deal with game mechanics—if a magic sword’s power comes from its being really really sharp, then its bonus should be to damage and to cutting through armor, but not to hit things that are dodging, right? That’s not how most magic weapons work in fantasy roleplaying games.
Some magic weapons are sentient. It’s easier to explain how they’re advantageous—if the sword is aware and can alter its own trajectory, it may simply think faster (and better) about combat than its wielder, and be able to improve its strokes effectively as a result. But melee combat is extremely complicated, requiring sentience to understand it, and most swords are depicted as not being sentient. So how does that staple. the +1 longsword, confer its advantage?
Humans are consummate tool-users, and all humanoid races in fantasy settings would more or less have to be also. Human brains are capable of adapting to tool use, which is one of the reasons we’re so good with them. One of the key ways in which our brains adapt to tool use is to expand the “maps” in our brains (which help us control our bodies) to accommodate the tools as if they were physically part of us. This is what happens after you use some tool for an extended period and it no longer requires conscious thought to do something with it. With practice, your brain adapts to consider the tool an extension of you.
My suggestion for the standard way in which magic weapons confer their bonuses is for them to magically enhance this process, to feel like an even more natural extension, to provide some kind of low-level feedback with extra information (about weight, speed, etc.) and an interface that helps the wielder comprehend that information. Such an interface is difficult to explain technologically, but at this level of granularity I have no problem with resorting to “it’s magic”.
If that’s how they work, this also points to countermeasures. Completely dispelling the magic is difficult in the D&D setting, but an effect that simply damped the signals of the weapons seems like it would be a fair low-level spell. Scrambling the signals, making the weapons give penalties, would be a higher-level variant. From there, some weapons could have enchantments that shield them from such interference, and so on.