Just thought I'd weigh in here.
I remember reading something about Bil'am in Me'am Loez about how he got his "powers". It had something to do with meeting two angels named Aza and Az'El which had left God's service on a test to show that humans don't deserve God's mercy. They were given free will and eventually started thinking of themselves as Gods.
I don't remember all the details but they had sent Bil'am on a mission to gather different things, and offer them sacrifices and ultimately completely devote himself to them. Once he did, he was shown how to use dark magic.
It was a long process, and it was described in some detail to show that to be dedicated to Avoda Zara, it wasn't a spur of the moment kind of thing, but rather a long demanding process which requires true dedication.
If you'd like, I could try to find it for you. I read this over a year ago so grain of salt.
Something else I "remember"...
Genesis 25:6
I believe it was Rashi who brought a source from Sanhedrin to explain that Abraham told them the names of impurity.
That'd be great.