Along the way our hero is mentally programmed by the bad guys to change his behaviour, but manages to escape his conditioning. As well as the rather fun pseudo-magic, there's a bit of biology thrown in: the witches have 'familiars' that are creatures made from their cells but relying on them to provide blood.
This isn't the only science fiction book to cover pseudo-religion as a cover for superior science. Robert Heinlein, for instance, had a cracking little number where the (US) locals fought off an (Asian) invasion using advanced technology posing as religious/magical power. I can't remember the title off-hand, but it suffered from rather advanced racism, I think. But Leiber's book is the daddy of them all and does it very well.
Review by Brian Clegg