gerrymandered district maps can get struck down on the basis of intention of racial discrimination. Correlation and intent are two very different concepts, and it is very dangerous to assume that everything that correlates do so by intent.
Indeed. Once a situation is suspected to be done by criminal intent, investigators can interview personal, go through search histories, looking for text conversations and so on. Once collected a judge can look at it and determine if there is or isn't intent.
It is a costly, time consuming and cumbersome process, but the legal system is quite used to it since almost every single criminal case involve some aspects of establishing intent.