The past couple of decades gave rise to the Dinesh D'Souza "rational racism" crowd. They argue that in a world of imperfect information, discrimination is a perfectly rational response to differences between racial groups, and as such, since it isn't rooted in bigotry per se, it just isn't something to get upset about.
In other words, if you know nothing about a person other than his skin color, and you know (let's stipulate for purposes of discussion that what you "know" is correct) that people with that skin color are more likely to steal from their employers, then it's simply rational for you to be less likely to employ people who have that skin color. Even though you recognize that not all people who have that skin color steal from their employers, given that you can't look into the soul of that person, and you know that people of that skin color, for whatever reason, are more likely to steal, your decision is justified.
Moving this to the subject of gender discrimination, let's consider the general assertion that a big part of the gender wage gap can be explained by different labor force participation decisions. Short version: women have babies and therefore have more frequent out of labor force spells. Especially for employers who invest a lot of job-specific human capital in their workers, this is bad. They hire you, they train you, and then you take off for a couple of years. And, skills can depreciate rather quickly in some fields. So, it'd be perfectly rational for employers to be less likely to hire (though it's much more difficult to get away with discrimination at the hiring stage) and promote women because their investment ends up being wasted.
So, if you're female you face barriers to advancement by "rational" employers, even if you have no plans to have babies and drop out of the workforce. But, this fact also impact your decisions -- if you expect that career advancement for you is going to more difficult than for men, then all else equal you're going to invest relatively less in your career and relatively more in other aspects of your life. Some women who would, if they were treated the same as men, not drop out of the labor force (either not having babies or having babies but having their husbands drop out), instead do so. Since the expected discrimination is factored into their decision making process, they're more likely to drop out of the labor force because the career is expected to be less rewarding (financially, spiritually, whatver).
This is (one reason) why simplistic arguments (and simplistic empirical work) about the impact of education/job experience on the gender wage gap are flawed. These choices are endogenous -- factors (discrimination) which influence female wages are also factors which influence education/job tenure choices.