How can I detect a toxic environment while on the interview circuit? If you are interviewing for faculty positions, how can you find out whether a particular work environment would likely be toxic? (Either generally toxic, or particularly bad for you as a {woman, early career researcher, researcher in a particular subfield, etc.})

Can such environments be avoided?

Can you ask about this during a visit or interview? Who should you ask (faculty, deans, students) and what should you ask that might elicit the relevant information?

Are there other ways to detect a toxic environment, besides for asking people who know to be on their best behavior for you?

This has been discussed here, here, and here for prospective PhD students, but not for faculty candidates (as far as I know). I believe the answers will be different for faculty candidates - for one thing, PhD students are likely to be honest when telling a prospective student about their advisor;  faculty members talking to a candidate about their colleagues, not so much. Also, the interview/visit procedure is different for faculty candidates, as are some of the relevant indicators of toxicity.

[Source: I read this question on FemaleScienceProfessor]
What I found useful was to be very watchful of how the interviewers act towards each other. Typically some sort of meal is part of an on-campus interview and you will be eating with several of the faculty members. If they can't make it through the meal without doing something objectionable you probably have a toxic environment. The funny thing is that they know to act properly towards you but will still forget to do so to their colleagues even though you are right there. 

As an example there was one such dinner where I was pressured into drinking alcohol the night before the real part of the interview and the junior (and female) faculty member who was present was the target of most of the jokes from the senior male faculty members. Both of these details did not help their chances of getting me to accept their offer. Fortunately I had another offer to take instead. 

This is by no means going to catch every situation you want to get away from but the general idea is to watch their behavior. In larger departments where the jerks are kept away from the candidates you may have to be more active in searching for these issues. I was mostly interviewing in small departments where I was able to meet everyone.