It's both. You need to have been born and raised in a conducive environment (i.e. if I had been born a woman in Afghanistan, I wouldn't have had a chance), and you also need luck (if my health had been crap, or I had been paralysed, I wouldn't be where I am either). But a lot of it is confidence, stubbornness and the ability to take risks, and get up after you fall.
I work as a midwife, in a lowish-income Western country. However, I have managed to turn this profession into a high-earning enterprise by working casual and self-employed, and taking on a couple of specialised roles, among them one I just landed recently, working for an international organisation teaching very niche skills to other healthcare professionals nationwide and internationally. As a result, this year I am on route to making the equivalent to GBP$100,000 in local currency, which is way beyond what most midwives here could dream (even though most of them work way more hours than I do).
But most midwives here are not ambitious, show very poor confidence (often they are actually really good, but they don't show confidence, which is what convinces others that you are, indeed, good, and deserving of your professional respect), don't dare to ask for more money than what they get offered, and in fact work a lot of their hours for free out of a misplaced sense of "duty". They feel "guilty" if they care about how much they earn. Impostor syndrome is rife among them.
I don't. I decided a long time ago that I would act and think like a man, and it has worked very well for me. I negotiate every job that does not offer me what I think is a fair pay for my work. But in order to do this I ensure I am the best at what I do and that my work is impeccable, safe and that the women/colleagues I work with are extremely happy with their care/training.
One example: a primary unit 1 hr drive away from my home needed a casual midwife to do ocassional 12 hour night shifts there. They offered X pay, which was fair for the actual hours worked, but nothing else. My response: "Pay is ok, but this is an hour away from my residence, so I want mileage on top, and as I will be called out of the blue in the middle of the day to go to work all night, I want a place to sleep some hours after the shift, so I am safe driving back home". Initially I got told they couldn't pay for that, and that "other midwives in the area don't ask for those privileges", so I answered: "Great, then please call those other midwives. I'll be here if you change your mind. Good luck!". 3 days later I got a call. Surprise, surprise, she found that they could indeed pay me mileage and get me to stay at the nurses accommodation for free. So then I said yes.
Of course I have lost contracts where they didn't offer enough or they didn't come back to me, but I can assure you I have never been low in offers of work, especially when you leave behind a reputation of being good at your job. And I have actually found that, the more demanding of pay and privileges you are, the more respect you get and the more they call you. The midwives who offer to do the work for $200/day ("oh, that's enough for me, I don't need that much") often are the same ones who refuse to take on complicated cases, don't keep their skills up, only want to do shifts in postnatal ward, are unreliable and/or are shit at managing emergencies, so after a while their employers keep coming back to me. They know I can be called to do a home birth at the top of a hill, or fly a woman with raging pre-eclampsia to another hospital and then stay and resuscitate their baby before being flown back.
So yes, luck plays an important role. But in order to take advantage of luck, you have to be ready, and be brave to make quick, sometimes risky decisions. If you have these qualities, and money is what you want, you can make money basically in ANY profession and any area.