A very rich man summons an alien (who is in his bathtub) to make a deal. The man has figured out that it is not magic. He trades some technology or knowledge for his brain at death. The brain goes into a giant hive mind computer, but later the man's brain takes over the computer. I think it might have been by a female author.