From what I understand, ceremonial magick in the late 19th/early 20th century was dominated by men - but contemporary witchcraft/Wicca seems to be very much dominated by women. How and why did this apparent shift in gender roles occur?
In a very broad sense, before the 19th century you had two main streams of "magical" practice in Europe: 1) native traditions of folk magicians like the British "cunningfolk" (who could be male or female), and 2) scholarly magicians based primarily on written sources, as exemplified by the manuscript grimoire tradition; the latter was usually restricted to educated male practitioners. Social and economic factors lead to the gradual decline of the "cunningfolk" and the increase of printing and literacy made written materials about magic more available to the public - including women.
Shifting gears a little: in the 18th and 19th centuries, Freemasonry, which largely did not have any explicit occult connotations but which served as the model for any number of similar fraternal societies, was almost exclusively a male-only series of establishments. This began to change in the late 19th century as advocates for women's rights pushed for or established "Co-Freemasonry" and similar organizations that admitted both men and women. These co-ed masonic organizations in turn directly influenced turn of the century occult organizations such as the Hermetic Order of the Golden Dawn and the Theosophical Society, the latter of which was headed by a woman, Helena Blatavasky.
So by the early 20th century the ongoing effort of emancipation of women in the United States, the United Kingdom, and elsewhere meant you had a larger population of educated, independent, and intellectually curious women - and some of those took an interest in magic and the occult. This ranged from influential non-practitioners like Margaret Murray, whose books starting with The Witch-Cult in Western Europe (1921) would be so influential in later decades, to influential ceremonial magicians like Dion Fortune, author of The Secrets of Dr. Taverner (1922) and numerous magical manuals.
Murray's central thesis of a surviving witch-cult, Masonic organizational concepts and regalia (sometimes filtered through offshoots like the Ancient Druidic Order) and some of the ceremonial magic practiced by the Hermetic Order of the Golden Dawn and its offshoot organizations were combined by Gerald Gardner in the 1940s to form Wicca, which was first disseminated in High Magic's Aid (1949), Witchcraft Today (1954) and The Meaning of Witchcraft (1959). Gardner's system and organization was explicitly co-ed, and he initiated recruits like Doreen Valiente, who would author such important bits of lore as "The Witches Rune" and "The Charge of the Goddess."
Aside from the participation of women as equals in the magical/spiritual/organizational enterprise of Wicca, the emphasis of the Goddess (inspired largely from Murray's work) and the popular interpretation of historical witches as largely being women likely contributed to the popularity of Wicca and related new religious practices among women in the ensuing decades. I stress likely because Wicca isn't something that sprung up overnight, and the whole movement of women having greater representation and participation in the predecessor organizations goes back a fairly long way, but really seems to have gained steam with the ongoing success of women's suffrage and women's liberation movements. I would say that the greater education and economic freedom of women enabled them to participate more freely and prominently in the occult and new religious movements, and that Wicca was particularly attractive in this regard to many women.