There have been lots of good comments here about the reality of how being pregnant, taking maternity leave, inevitably being the lead parent impact women. All true.
But I think it starts way sooner than that. For a start, this fallacy that women don't ask for raises, promotions etc. More recent research shows they do. But they don't get raises, promotions etc at the same rate. So a woman might ask, but her raise, if she gets it, will be smaller than a man who asks.
Another absolutely key thing is still that women gravitate to less well paid industries and careers and there are huge societal issues to this from why are these careers less well paid to why are women always in them.
I was very successful, worked in the City at investment banks. Was promoted etc etc. But .... 1. I earned less than men in similar roles. IN part, ironically, this was because I was often younger than those men and somehow therefore it was justified. And in part it was because I was a woman. 2. I had a great career and achieved relative seniority quite young BUT I worked in a (female dominated) support function and therefore we ALL earned less. I have many male friends who were junior to me in banks and even though they also worked in support roles, they were male dominated support roles - IT , business management etc - and so they earned more in both salary and bonus.
I hav asked myself many times why roles in functions like HR and Communications and Marketing, all female dominated, are always the least well paid within big corporates. These roles are as important. My male friends in IT, business management, project management etc were not only junior to me but also had a fraction of the access and "power" I had in terms of senior people within the organisation. But these roles are still seen as lesser, and earn less. (except for at the most senior levels where, interestingly, men are more represented: Women make up the majority of people working in these roles but the most senior roles have a higher proportion of men compared to the average. Which is yet another issue).