Despite the above, there are a few important things you can do to line up your "weapons" if and when you get unlawfully terminated as a result of discrimination or retaliation:
1. Make sure that your boss cannot blame terminating or demoting you on your performance. This is a critical time to do the best you can, as the employer's love to use poor performance as excuse for termination, because it's so subjective and relatively hard, although possible to argue against.
2. If there are any witnesses to unfair treatment, get their statements in writing if possible, and keep their contact information. In many cases with opposing sides having opposing story, witness statements are crucial.
3. Keep all relevant documents, emails and other documentation proving discrimination, retaliation, or your complaints to HR or your superiors about the same, as they will be of critical important when proving your case in court.
4. If you witness discrimination or harassment against yourself or others, complain to HR in a courteous but firm manner and ask for investigation in writing.
5. If you are terminated, do not sign any releases in exchange for severance before you consult an attorney, as signing a release usually extinguishes all legal claims, committing the signing employee to never sue the employer for any violation.
Then, when the time comes and you are well equipped to fight, the results will be better and the process will be likely shorter, as the employer, facing substantial evidence against them will likely want to settle faster.