During a job interview, you ever been quizzed about whether you're married and if you have children as a way to gauge your future attendance? Or, has a prospective employer ever asked you if you have help at home to ensure you won't miss work every time your kids are out of school? I have. It doesn't matter if the questions are legal or not. And I am certain those men interviewing me did not ask any male candidates those questions.
There's still a perception that women are less dedicated to work than their male counterparts. Corporate America blames women for it, but the reality is they also don't support the policies that would support equality, such as providing all parents with leave regardless of gender when a child is brought into the family. And even companies that do offer this routinely give their male employees a hard time when they ask for the time off or push them to return to work sooner. Probably because they can still get away with it.
That is the flip side to the equality debate that doesn't get enough press. There can't be better conditions for women if the policies toward men don't change.
I suppose the more succinct answer to your question is: because some companies focus on the best candidate regardless of gender and therefore have diversity in their teams, and others either are sexist or have sexist policies.