From Ellicott's Commentary for English Readers:
Exodus 22:18 [cf. Deuteronomy 18:10-11] - Thou shalt not suffer a witch to live.—The word translated [by some Bible versions] “witch” . . . is the feminine singular [i.e., sorceress of that rendered by “sorcerers” in Exodus 7:11, and means “a mutterer of charms.” The use of the feminine form can only be accounted for by supposing that, practically, witchcraft was at the time mainly professed by females. Whether “witches” had actual help from evil spirits, or only professed to work magical effects by their aid, the sin against God was the same. Jehovah was renounced, and a power other than His invoked and upheld. Witchcraft was as much rebellion against God as idolatry or blasphemy, and deserved the same punishment [my emphasis].
From Benson Commentary:
Exodus 22:18. Witchcraft not only gives that honour to the devil which is due to God alone, but bids defiance to the divine providence, wages war with God’s government, puts his work into the devil’s hand, expecting him to do good and evil.
In the account in 1 Samuel of Saul's encounter with the witch (or medium, NASB Updated) at Endor, the woman asked Saul,
"'Whom shall I bring up for you?' And [Saul] said, 'Bring up Samuel for me.' When the woman saw Samuel, she cried out with a loud voice; and the woman spoke to Saul, saying, 'Why have you deceived me? For you are Saul. . . . I see a divine being coming up out of the earth'" (vv.11-13).
From the footnotes of the NET Bible comes the following:
"The Hebrew term translated “mediums” actually refers to a pit used by a magician to conjure up underworld spirits (see 2 Kgs 21:6). In v. 7 the witch of Endor is called the owner of a ritual pit. See H. Hoffner, “Second Millennium Antecedents to the Hebrew ’OñBù,” JBL 86 (1967): 385-401. Here the term refers by metonymy to the owner of such a pit (see H. A. Hoffner, TDOT 1:133)".
Now obviously, while the word witch (or sorceress) is not the same word, medium, used in the 1 Samuel passage, the witch at Endor intended to act as a medium between this world and the realm of the dead and "call up" a spirit; that is, until God "beat her to the punch"!
Interestingly, a sorceress could anachronistically be called an occult druggist or herbalist who uses drugs and herbs in her ritual pit--along with her mutterings--either to (possibly) communicate with an evil spirit ("demon") which would mimic the dearly departed, or simply to set the stage for what she knew to be a sham, much like the hostess of a séance might do today. Either way, the witch at Endor was evidently shocked ("she cried out with a loud voice") to be seeing the spirit of Samuel, which/who appeared to her as an "old man wrapped in a robe."
To set the stage, so to speak, albeit in an artistic, anachronistic, humorous way, I could do no better than to quote Shakespeare. (from Macbeth):
A dark Cave. In the middle, a Caldron boiling. Thunder.
Enter the three Witches.
1 WITCH. Thrice the brinded cat hath mew'd.
2 WITCH. Thrice and once, the hedge-pig whin'd.
3 WITCH. Harpier cries:—'tis time! 'tis time!
1 WITCH. Round about the caldron go;
In the poison'd entrails throw.—
Toad, that under cold stone,
Days and nights has thirty-one;
Swelter'd venom sleeping got,
Boil thou first i' the charmed pot!
ALL. Double, double toil and trouble;
Fire burn, and caldron bubble.
2 WITCH. Fillet of a fenny snake,
In the caldron boil and bake;
Eye of newt, and toe of frog,
Wool of bat, and tongue of dog,
Adder's fork, and blind-worm's sting,
Lizard's leg, and owlet's wing,—
For a charm of powerful trouble,
Like a hell-broth boil and bubble.
ALL. Double, double toil and trouble;
Fire burn, and caldron bubble.
3 WITCH. Scale of dragon; tooth of wolf;
Witches' mummy; maw and gulf
Of the ravin'd salt-sea shark;
Root of hemlock digg'd i the dark;
Liver of blaspheming Jew;
Gall of goat, and slips of yew
Sliver'd in the moon's eclipse;
Nose of Turk, and Tartar's lips;
Finger of birth-strangled babe
Ditch-deliver'd by a drab,—
Make the gruel thick and slab:
Add thereto a tiger's chaudron,
For the ingrediants of our caldron.
ALL. Double, double toil and trouble;
Fire burn, and caldron bubble.
2 WITCH. Cool it with a baboon's blood,
Then the charm is firm and good.
All these incantations could fall into the category of "mutterings," which is the biblical term for sorcerers' locutions, whatever form they may have taken in the history of Israel .
The study of the occult from a biblical perspective is a complicated one, in no small part because of the various and numerous terms used of these forbidden practices. These terms include (not an exhaustive list):
sorcerer, sorcerers, sorceress
enchanters
Chaldeans
wise men
diviners
interpreters of dreams
auguries
wizards
teraphim
those who purge a child by fire
omens
incantations
signs
questioners of the dead
auspices
spells, cast spells
Depending on the context, then, a sorceress could be a medium, a witch, a diviner, a spell caster, a soothsayer, a questioner of the dead, a magician, or a specialist in incantation. The primary tool of her trade, besides drugs and herbs, was mutterings designed to communicate with the spirit world, which we today would call the realm of the devil (and his demons), the father of lies, deceptions, half-truths, illusions, and counterfeits of the truth.
In conclusion, God is light, but occasionally God, at His own discretion, will delegate tasks to the dark world, as He did with Balaam, the lying prophet (see Numbers 22, and cf. 2 Peter 2:15 and Jude 1:11). To seek the powers of or favors from "principalities, powers, and authorities" (Ephesians 6:12) is an affront to God, and those who do so are subject to His wrath (see, for example, Acts 19:13-20), hence God's command that a sorceress be put to death (Exodus 28:18).