There is a lot of talk about swords in Sword & Sorcery fiction, but not as much about the other word. Sorcery is, after all, the other half of the equation, only it does not get nearly as much play. Magic is a constant presence in S&S, but not an ubiquitous one, and the purpose and ethos of magic is something that varies all over the map.
Firstly, and most obvious, magic is not a real thing. Swordfights and battles and the clash of steel are things that really happen, or did, and so a writer has a tremendous amount of information to draw on when writing about them. You have a lot of precedent, and also a lot of data. You can look up cutting tests on Youtube and get an idea of the performance and characteristics of almost any kind of weapon. You can see videos of various fighting styles and schools, and get a hundred details you can throw in for verisimilitude.
But magic is not a real thing, and while one can draw on the various traditions of occultism for inspiration, you are more or less free to make shit up. This is a two-edged sword, because on one hand that is a lot of freedom to have magic do whatever you want it to, but on the other, that can be a lot of worldbuilding for a short story. Usually, an author will come up with one style of magic and either have a shared universe for their works, or just use the similar kind of sorcery for all their stories regardless.
By and large, this has led to magic being the domain of villains, because that way you don’t have to define your magic as thoroughly. Brandon Sanderson came up with a principle for magic in fiction, holding that the amount of detail you had to put into your magic system was more or less proportional to how many problems you let the protagonists solve with it. In other words, you can pull things out of your ass to make life harder for your characters, but doing it to get them out of trouble is cheating, and will feel like cheating.
And thus was born the archetype of the Evil Wizard in Sword & Sorcery fiction. You could say it started with Howard villains like Thoth-Amon, Thugra Khotan, and most famously Xaltotun. All of these characters share certain characteristics: they are old, undying, or resurrected from death, they draw their power from forbidden knowledge that predates the age of humanity, and they are all coded as non-white.
This was part of what Howard borrowed from Lovecraft, and it was very much part of his idea of magic – that magic power derives from knowledge that will drive men insane, and so any man who wields such power will be crazy and evil. The Evil Wizard does not fight his enemies with sword and dagger, but plots and schemes from the shadows, dispatching assassins, curses, and deadly animals or demons to do their work. In the face of the raw physical power of Howard’s muscular heroes, they are often helpless, once their minions and tricks have been brushed aside.
But for the origins of the archetype, we really have to dig back further, and out of the realm of fantasy fiction and into the adventure fiction of British author Sax Rohmer, and his indelible creation Dr Fu Manchu. This is really where the basic stock images of the Evil Wizard originate. Steeped in ancient evil, descended from a lineage separate from ordinary men, Fu Manchu lurks on the shadows, master of an array of exotic poisons, drugs, torture techniques, and a legion of fanatical minions. He is a sorcerer in all but name, and in fact Howard himself pastiched the Doctor in his novella Skull Face, explicitly making his off-brand Doctor, Kathulos, a surviving Atlantean.
Rohmer said he based Fu Manchu on Asian crime bosses he met while he was a reporter in Limehouse, and the casual and cartoonish racism of the tales is hard to do anything but laugh at now. But the archetype sank into the popular culture, and surfaced as the Evil Wizard image. We picture our sorcerers encamped in dank laboratories, surrounded by grotesque experiments, reading forbidden books. They wear strange facial hair and probably a skullcap, they turn the pages with long, pointed nails and breathe in drugged smoke to have visions that unlock their secret knowledge.
It is significant that when Moorcock made Elric his hero, he made him a wizard, and thus he had to define much more clearly what that power could and could not accomplish. Yet one thing that did not change was that magic was dangerous and unclean. The powers wielded by magic in S&S are not the Vancian style of “wave wave boom” made popular by role-playing games. Magic in Sword & Sorcery has a cost, whether in blood, or more often in sanity. Lovecraft left his mark on the genre with a tradition of magic that is essentially inhuman and dangerous, no matter who is using it. There may be those who would use sorcery for good ends, but the means will always remain twisted and evil.