Were witches and other people who practised black magic not necessarily accepted in contemporary society and same for pagans and polytheists who worshiped dark gods who were evil spirits esp those who were the equivalent of Satan in their religion?
Maybe I'm pedantic, but I think the answer kinda answers itself when you consider the definition of what exactly are "Black Magic" and "Dark Gods".
Black magic, in its usual definition, specifically refers to magic that is aimed at doing malevolant acts. If you were openly practicing it, no matter in what kind of society you lived in, you wouldn't be looked favorably upon... At best you're either a creepy weirdo or part of the criminal world.
And while Dark or Evil Gods can exist in mythology... Well, the religions aren't generally about worshipping them. Gods can be terrible and in need of appeasment but generally the religion doesn't describe them as evil or malevolent, save maybe for a few specific case. If you religion mentions a Dark God however, that god is the adversary, the thing you must fight and never make contact with. So of course this kind of behavior wouldn't be accepted. Bringing you back to being a creepy weirdo and/or part of the criminal world.
Now you could have heterodox and/or non-conformative practices that would be assimilated to Black Magic and worshipping Dark Gods yet still be accepted... But that's opening a different can of worms and discussing the concepts of Orthodoxy and Heresy.
Were they possibly even persecuted?
Definitely.
I vaguely remember reading that the Romans weren't exactly fond of witches, which might have played a role in Christiannity's attitude towards them (though Judaism and the Old Testament already have traces of that hostility).
Plus, as I said, if we go by the definition alone, then it's only logical that they would be persecuted. Communities are generally pretty big on Conformity, Legality and Orthodoxy, so deviations are only tolerated as long as they stay within what's judged acceptable. But being openly practicing dark magic or worshiping evil wouldn't be.
Our modern concept of Satanism, both ironic & un-ironic, didn't exist in the Middle Ages, nor did any modern occultist groups.
Ironic Satanism maybe because it's more akin to a kind of atheism aimed at actively opposing Religion by making fun of it. This wasn't very common in the Middle Ages and the few atheistic texts we have don't really say they worship Satan... because that would be suicidal.
Unironic Satanism and Occultist Groups however probably did have ancestors and precursors in the Middle Ages. I mean, the knowledge they have has to have come from somewhere and we do have old medieval texts delving into the stuff. It's just that, as expected, these groups would be small and secretive. Not to mention the possibility that they were actively persecuted, considering the whole problem of Orthodoxy and Heresy.
Official, according to the Catholic Church, that magic (black or otherwise) did not exist (Protestantism varies, but i have a feeling you're referring to pre-Reformation times). Belief in magic was a heresy, both trying to practice & trying to accuse someone of practicing it. (I'll get to actual witch-hunts at the end.)
From what I understood, it's actually quite a bit more complicated than that...
The thing with magic is that in the Ancient and Medieval World, the term doesn't necessarilly referred purely to the occult or to spells. It could also refer to a form of science that dealt with phenomenons that were badly understood. That's why wizards and mages tend to be portrayed as wise men and scientists, both in mythology and in fiction: they have access to a form of hidden knowledge.
It also led to a distinction between Ritual and Natural Magic. Ritual Magic is generally what the Church highly frowns upon because these are generally occult rituals that look like heretical if not demonic practices (and often are regarded as such). Natural Magic though tended to be tolerated as it was seen as just a form of science. Kinda how Alchemy and Chemistry weren't split originally and the former was considered part of the latter. Of course, if you used natural magic for nefarious means, you could still be in trouble... And there were definitely heretical use of natural magic.
Finally, the Catholic Church does believe in Miracles and Demonic Possession. Protestantism denounced the Cult of Saints, but the Catholic Church never did. Sainthood however is a thing that needs to be properly checked and miracles need proofs before they are accepted, that proof being that you can't find any other logical explanation beyond the fact it was God's will. It's very codified procedure involving a lot of paperwork. And also where we got the famous Devil's Advocate, as in trials of Sainthood he is supposed to dismiss and contradict the candidate's sanctity.
As for Demonic Possession, the Church does have official Exorcists in charge of dealing with that. The truth is that more often than not they're more proto-psychatrist with a religious vibe (roughly), but they do think they have to deal with real possession from time to time and are officially allowed to do so.
Of course, Saints and Exorcists aren't qualified as magicians, even if what they do could be considered a form of magic.
Basically, it's not that the Church doesn't believe in magic. It's more that most magic practices are regarded by the Church as being heretical and sinful, and thus magicians, witches and other magic users are considered either charlatans & liars (thus sinners) or heretics, pagans and/or devil worshippers (thus bigger sinners).
Now, for actual historic witch-hunts. If belief in magic & witched was a heresy, why were their witch hunts? The same reasons there are hunts for any other scapegoat. Rationality takes a step aside & lets fear, especially fear for absolute safety, take over.
That part is kind of on point... But again, the problem wasn't really the belief in magic: it was more the practice.
Witch Hunt generally went after scapegoats true, but they were generally accused of practicing witchcraft because they were doing stuff that was regarded as weird and non-conformative by the crowd. And that wasn't accusations thrown at witches alone: Jews were often the target of such accusations (probably not helped by the discovery of texts from the Kabbale...), as were probably other "deviant" groups.
The last thing to mention is that Witch Hunts generally weren't highly regarded by the Church. Mostly because it was more commonly the results of actions from laymen and thus not clergymen. Heresy is serious business for the Church so it needs to follow proper procedure, trials and courts. Witch Hunts however are activities that generally don't give a fuck about all that and rarely bother calling the Inquisition... And when the latter gets involved, it can still be hijacked by lay authorities.