Is there deliberate gender preferential treatment in hiring or admission in STEM fields?
It's rather subtle trying to decide what counts as gender preferential treatment. For example, suppose the hiring committee decides to interview Bob, Carl, and Dave. As a sanity check, someone goes through the applications from women to see whether anyone was overlooked, and they are impressed by Alice's application. There's some debate about whether she looks quite as strong on paper as the other three, but the department decides to interview her as well. Alice is extraordinarily impressive in person, and once all the interviews are complete and the department has learned more about her work, she is the unanimous first choice. Does this count as preferential treatment? A male applicant might not have been rescued from being overlooked the way Alice was, but he might have been less likely to be overlooked in the first place, so it's difficult to give an objective answer (it depends on which counterfactual scenario you imagine). Gender was not relevant for the decision once all the information was gathered, but deliberate steps were taken based on gender to minimize the potential for bias in the process.
In my experience with mathematics in the U.S., these sorts of steps are pretty common. In the committees I've served on (for both admissions and hiring), people have often gone out of their way to try to identify diverse sorts of candidates and make sure they are not overlooked or disadvantaged. Not everyone participates eagerly in this, but some do it out of conviction that it's intrinsically worthwhile, while others play along to keep the administration from complaining. On the other hand, I've never seen this process extend to advantages in the final decision. In particular, I haven't seen a case in which Alice was hired or admitted instead of Bob just because she was female, although the committee was more impressed by Bob than Alice otherwise.
Tie breakers are the closest I've seen to an explicit preference. In graduate admissions many decisions are easy, but there's always a (small) group of comparable candidates right near the borderline for admission, where nobody can give a compelling argument for why one is superior to another. Within that group, being female could prove an advantage: if Alice and Bob are equally strong candidates in other ways, but Alice would help bring gender balance to the department and Bob would not, then that's a good reason to admit Alice. This doesn't generally arise in hiring, since few enough people are hired that there are many strong opinions and the hiring committee is unlikely to decide two candidates are truly tied. However, it can happen in admissions, which is a lower-stakes process carried out on a larger scale and with less information. I'm mainly mentioning it for completeness, since few applicants are actually close enough to the cut-off for this to matter.
In Germany, women are in some instances preferred over men for professor positions, to the point of excluding male applicants at all.
There are scholarships and other forms of funding specifically (and exclusively) geared towards women (at all levels). A prominent example is special funding for female professors by BMBF:
[Secretary of Education Schavan:] "There are not enough female professors, most university teachers are men. [...] 260 new positions have been established [between 2008 and 2012] thanks to the Female Professors Program and have been staffed with women. This is a success - but not nearly enough. Therefore we have initiated a second round."
[...]
Up to three [female] professor positions per university [are possible]. [We make] an additional 150 million Euros available for this purpose until 2017.
Best-effort translation by myself from the German original.There are professor positions offered only to women¹.
For one thing, there are "additional" positions like those mentioned above or e.g. at FU Berlin (1, 2).
[Departments] could apply for being assigned [such a position]. [...] [The applicants] must bring forward proof of at least one highly qualified female applicant.²
Best-effort translation by myself from the German original.This is probably an effect of additional funds for women being available (cf 1).
But also regular positions can be designated for women only, see e.g. these commission minutes from FHTW Berlin (page 8):
One of the two professor positions will be tendered twice as women-only position.
The [Academic Senate of the FHTW Berlin] passes the motion [with 9 yes, 0 no, 4 abstention].
Best-effort translation by myself from the German original.Official statements regarding systemic discrimination (of men) are hard to come by (even if it is effectively encouraged/enforced by policy at times). See some press on one case here and here.
There are support structures available only to women, such as the concept of Frauenbeauftragte (Am. women's affairs officer) (who have special roles and privileges) and often have funds spent on e.g. training seminars only open for women (which is not always enforced).
You hear stories, but there will often be no paper trail as these things can and tend to be decided behind the curtains. The way hiring of professors works in Germany, if the commission wants phenotype X, they can get it (if they play their cards right). In the gender question, this may be a result of a) policy makers demanding more female professors (by way of blocking any other choice) and b) the funding situation (cf 1), esp. in the light of decreasing funding across the board.).
They then say, "after the position has been assigned to the department, a regular hiring process ensues". I'm not clear if that means male applicants are admitted, or if only the process itself is a regular one.
I can only provide answer about Graduate school admission.
In the countries where graduate school admission is based on written exams and the student names on the exam papers are sealed when grading, the gender preferential treatment is next to impossible.
In Taiwan, where I live, this was the case a few decades ago. However, the sytem has been changed to include written exams, oral exams and recommendation letters in some cases, no one knows how much bias is there. As far as I know, there are more female scientists than in the past. I will find some hard data if there is some available in English and update my answer here.