One question is how much firms pay men and women, relative to their marginal products; here are some previous MR posts on that topic. A second question, neglected somewhat by economists (but not ignored more generally), is how men and women (and other genders) treat each other within the firm.
To go down this purely hypothetical path, let’s say a firm pays women their full and fair market value, but the firm is embedded in a city where men lord it over women, perhaps because of income inequality and unequal ratios in the dating market. Within that company, men may treat women in unfair ways. They may harass them, or simply listen to them less, or perhaps refuse to serve as mentors. The surrounding urban culture makes this a stable equilibrium, because the men in this company do not need the women so much for their preferred “total life portfolio” of gender relations. For purposes of contrast, if men need their particular workplace to date and marry suitable women, or even just have them as friends or mentors, those men will treat these women more courteously. (NB: is there an equilibrium where this attention leads to worse treatment? Maybe sometimes the women simply prefer to be ignored. I have heard that male tourists in Bangkok do not hit on the female tourists they meet there, for instance.)
The (fair) firm will fire egregious male offenders of the company’s norms, but some of these offenses are neither observable nor contractible. So imagine the firm setting the wage first, and then the men within that company claw back some of the employee surplus of the women by harassing those women.
The more fairly the company pays women, the more men within that company can harass the women, if only because the women are less likely to leave the company (the participation constraint).
So some of the benefit of paying women their fair share ends up distributed to those men, within the company, who wish to harass or otherwise mistreat those women. And of course the unfair treatment of women does not have to come from harassers, or even from men. It also could come from other women, or from relatively impersonal processes, such as inquiries and tribunals, which perhaps in some manner, possibly unintentionally, are less well geared to represents the interests of women. So you should interpret that word “harassment” in the broadest possible sense.
One prediction of this model is a good deal of harassment in sectors that have relatively strong pay equity norms. Furthermore, men bent on harassment or mistreatment of women may be among the biggest supporters of pay equity within their institutions.
The greater you think is the scope for potential male mistreatment of women, the weaker is the pecuniary case for pay equity norms, at least in a short-run, partial equilibrium setting (you might think in the longer run you can shift all the norms with tough, across-the-board enforcement).
Conversely, imagine you can shift the norms within a company so the male employees treat the female employees better. That weakens the pressures for the company to pay the women their full marginal products. Even a company bent on “being fair” may find it hard to spot the underpaid women, because they are not always leaving and revealing that better pay should be offered.
A broader point is that the ethos of a company can only deviate from the ethos of its geographic location by so much.
Of course that is all just in the model, the real world is quite different. In the real world, selection and clustering effects overwhelm the logic of compensating differentials, so there are good institutions and bad institutions. The good institutions pay the women what they deserve, and have stronger norms against harassment and bad treatment. All goes well there, and for that reason it is not hard to tell which are the good institutions and the bad institutions.