Was it a matter of meritorious promotion, or political connections, or a combination of the two?
Oh, yes, there were many ways a woman could become the leader of a religious community in the Middle Ages. And Hildegard of Bingen witnessed almost all of them.
I. Live an exemplary life in a strategic place and gather a new community around yourself through reputation
When Jutta von Sponheim elected to enter a formal religious life in 1112, she chose to be enclosed in a "cell" (in this case, probably a set of rooms) attached to the men's convent at Disibodenberg. 14-year-old Hildegard and another girl went with her. Jutta quickly developed a reputation for holiness that spread far and wide. Women and men alike came to consult her on spiritual matters. And Jutta inspired enough women to take religious vows and join her that her "enclosure" ended up as essentially a women's convent attached to--and subordinate to--a men's.
Christina of Markyate is another well-known example of this method. (And interestingly enough, she is an exact contemporary of Hildegard--there's a pretty good likelihood they were both born in 1098).
II. Be elected on the basis of merit
That would be Hildegard herself.
While Jutta was alive, she seems to have kept her visionary gifts and writing/composing/political ambitions to herself. (Also, Hildegard would very strongly protest my use of the word "ambitions" there.) The first known vision that she expressed when she had it was, in fact, at Jutta's funeral. Nevertheless, Hildegard's leadership skills and holiness were evidently quite clear to her sisters at Disibodenberg.
Hildegard's letter collection presents ample other cases of election. Mostly, women and men chosen to lead their communities wrote to Hildegard with their inner conflicts, fearing that to take the leadership position would threaten their time and ability to devote themselves fully to God.
III. Found a convent with a ready-made group
...That would also be Hildegard.
She had some pretty strong beliefs on Benedictine monastic life, sought a different lifestyle than was apparently possible in the 'enclosure' environment, and--above all--wanted her nuns to be free of the Disibodenberg monks' control. It took some doing, but eventually she founded two convents under her oversight--the Rupertsberg, where she lived; and Eibingen, which actually still exists today!
IV. The convent's patrons get what they pay for
One of the Rupertsberg nuns, Richardis, willingly left Hildegard's community to lead her own. Hildegard's efforts to prevent her departure are a good window into the various outside powers that could, and frequently did, intervene in nuns' own choices (helping OR hindering). The archbishop of Bremen in the 1150s was Hartwig, Richardis' brother. So when his family obtained the abbess-ship of the prestigious convent at Bassum for Richardis, Hartwig had the power to enforce the choice.
Quite a few of the surviving letters to and from Hildegard involve this situation, giving us multiple perspectives on the matter. (Though never, it must be said, Richardis' own words.)
V. (Which Hildegard would have hated) Found an entire new monastic order
A variant on III. In the mid-12th century, Hildegard was witness to the first flowering of multiple, separately Rule-governed monastic orders in the West--not just reform movements that affected some houses but not other. That is, this is when "monasticism" becomes "the Benedictine Order" and all the subsequent new orders.
Yes, most medieval monastic orders were founded by men. But not all. The Poor Clares (Second Order Franciscans) and Birgittines, founded by...well, Clare of Assisi and Birgitta of Sweden (bet you didn't see that coming) are probably the most famous. The Birgittines are especially interesting in this case because the order's structure is based around "double houses"--that is, a woman's convent and a men's convent administered together, though entirely separated as single-sex communities--but unlike other order, in this case it's the abbess who is the head of the entire thing.
VI with shades of IVb. Installed by the order to reform a house
The history of monasticism in the Middle Ages (and, frankly, of Christianity in general) can more or less be described as a series of reform movements. But especially in the late 14th and 15th centuries, "reform" is often a technical term. A very organized and widespread movement known as Observant reform spread throughout different religious orders, especially but not only the Franciscans and Dominicans. A typical procedure would involve bringing in a few nuns or friars from an already-reformed convent to lead the reform of an existing house.
Sometimes a few current residents would refuse to accept reform and move to a different community; sometimes essentially all existing residents would refuse to accept reform and move to different communities. Hence "shades of IVb": the conversion to Observance in those cases was typically the result of the monastery's outside supporters, secular or ecclesiastical.
I certainly don't mean this list to be exhaustive, or to cover more informal religious communities (like two women buying a house together and pledging themselves to lives of charity and chastity). But it's a good overview of some of the most common ways women could become the leader of a formal women's religious community.