How can I detect a toxic environment while on the interview circuit?
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.