Based on what I have learned so far by listening to women.
If you work in science or technology and spend any time listening to the honest views of women around you, you will find that many report experiences of sexism and an environment that is hostile to them. Listen to them.
Men sometimes undervalue women’s views, ideas and experiences, talk over them and shut them out of discussion, even in discussions about sex, gender and discrimination where they clearly have vital, distinct experiences and knowledge. Don’t drown out their voices.
When you see that other men are not listening to women’s experiences, are drowning out their contributions, dismissing their concerns or derailing discussions they have initiated, what should you do? You will need tact and judgement to determine whether your support is truly helpful – for example, if you get drawn into a predominantly male argument it is surprisingly be easy to become part of the problem, rather than the solution.
Women’s ideas are sometimes dismissed, ignored or doubted until expressed by a man. If you want to amplify, echo or support a woman’s view, it can be helpful to make it explicit. “I would like to amplify what Dr X has said”, “I agree with Dr X”. This avoids any impression that you are taking credit for her idea, and it helps remind other men to listen to women.*
When you see overt sexism or misogyny, yes, you should speak up. Confront it.
This is going to take some judgement, sometimes we need to stand up, often we need to pipe down. In both cases it will feel uncomfortable, in my view, that male discomfort is the feeling you get when a sexist culture is changing for the better.
Note: I have focused on women and sexism, but if you look around you will find other groups are under-represented and marginalized in your workplace. Try the same techniques: listen to the people affected, then try to advocate for change that will improve matters.
*In this spirit I should acknowledge the people whose ideas I have incorporated in the above advice who most recently and directly include @zerdeve (especially this thread), @o_guest (twitter) and @noodlemaz (blog and twitter) although many others have expressed similar views. Misunderstandings or mistakes are my own. The tip about explicitly acknowledging women whose views you agree with and want to amplify was arrived at by trial and (especially) error – one error pointed out gracefully (but forcefully) by Prof Ursula Martin was helpful. Of course, I like other-well intentioned men, will make mistakes in the way we respond to women’s concerns about sexism.