You have asked three very distinct questions (one in the title of the question and two in the body). I have done my best to answer them in the most factual and literal way possible.
Disclaimer: I am commenting about your questions regarding whether certain things are "normal". None of what I write below should be interpreted as an expression of opinion about whether such activities are moral or immoral, ethical or unethical, good or bad for society, etc.
- Is it considered normal to publish job offers inviting candidates to apply based on their gender and / or race in academia?
Yes, in the US this is fairly normal these days. For example, the University of California, one of the largest (if not the largest) public university systems in the US, has a policy document titled University of California Affirmative Action Guidelines for Recruitment and Retention of Faculty. In the section titled "Best Practices for Faculty Recruitment" (pages 4-5) one finds the statement:
[...] It also is consistent with University policy and obligations as a Federal contractor for advertisements to state that “all qualified applicants are encouraged to apply, including minorities and women.”
In my personal experience, such statements in job advertisements, at the University of California and elsewhere, are fairly common in the US these days.
See also this webpage for more details and context on related University of California policies.
- Is it considered normal in the academic environment to discriminate candidates according to their race and / or gender for "egalitarian" reasons?
No, discrimination of candidates based on race and gender is not considered normal. It is also illegal in the US as far as I know, so even to the extent that such discrimination is practiced (which I am not aware is the case), you are unlikely to find anyone who will openly admit to it being normal.
I should note that your question is formulated as a loaded question, making it difficult to answer in a straightforward manner. In the title you are asking about the practice of inserting a statement encouraging women and underrepresented minorities to apply in a job advertisement; the followup question in the body of the post asks about "discriminat[ing] candidates", creating the impression that the practice described in the title of the question is the discrimination you are referring to. However, as far as I know such statements in job advertisements are not legally considered to be "discrimination", despite your insinuation that that's what they are.
- How is the choice of a candidate based on his or her gender and / or race considered "egalitarian"?
Again, this is a loaded question based on the (almost entirely incorrect, as far as I know) premise that candidates are being selected based on their gender and/or race and that this practice is justified by the people making the selection on the grounds that it is "egalitarian". This premise is quite far from what is actually happening. At the very least, as I said, since the practice would be illegal, anyone engaging in it would not be as open about their behavior as your question seems to be suggesting; rather, in the scenario where actual discrimination was occurring, the discriminators would simply pretend that the less qualified female candidate they selected is more qualified than the male candidate they passed over even though she wasn't, and not be talking very much about egalitarianism. And that is even assuming that this sort of discrimination is actually taking place, which as I said I have no evidence is the case.