One reason why bosses who misbehave manage to get away with it despite their inappropriate behavior is because there is no trace of evidence. The words spoken can always be denied, and if it comes to the situation where your word is against that of the boss, he wins. But if you have documentation that clearly explains his intentions, then your boss has to take responsibility, and he is held accountable for them.
Steps

Step 1. Obtain a copy of your duties when you are hired, or as soon as you think about it, and keep it for future reference

Step 2. Get a list of goals to achieve as soon as you are hired, including tools for measuring expected results

Step 3. Obtain a copy of all company regulations relevant to your employment, including a code of conduct
These documents are usually given to you when you are hired, otherwise ask for them. If you are a member of a union, ask your representative to make a copy of your contract.

Step 4. Keep a copy of any documents your employer asks you to sign

Step 5. Do not sign any documents that contain statements with which you do not agree

Step 6. Have in writing any instructions your boss gives you, which differ from the tasks described in your duties and objectives to be achieved
If the boss refuses to sign them, send him a report including the new instructions, and explain how they conflict with your job. Also make sure that what you understand accurately reflects the new instructions received.

Step 7. Write down details of any discussions you have had with your boss if you suspect something is inappropriate
Share these notes with him in a report, asking him if you understand everything correctly. Make sure you include the date and time of the conversation.

Step 8. Date, and sign all written reports to your boss

Step 9. Get help from within
If your boss continues to give you inappropriate instructions, copy the HR manager in the next communication you send, asking your boss for clarification.

Step 10. Ask for proof
If you have been accused of doing something inappropriate, ask for proof and do not discuss the matter until it is provided to you. Just say that the accusation is unfounded and that there is nothing to discuss, until there is tangible proof.

Step 11. Contact the union
If you are accused of doing something inappropriate and you are part of a union, immediately contact one of their representatives, and ask that in the future he too attend the meetings regarding the accusation. If you are in management and do not have a union, continue to deny the accusation, and refuse to discuss the situation until tangible proof is provided.

Step 12. Avoid having your boss produce false written evidence to accuse you
If there is written proof of the accusation, do not sign it for any reason. If you are forced to do so, write on the document that you do not agree with its content, but do not sign it!

Step 13. Never involve your colleagues in the matter, they may be forced to take sides against you, or put in an awkward position that threatens their workplace

Step 14. Seek help from the Equal Opportunities Commission
If you think you are facing discrimination, contact the Commission in your area.

Step 15. Keep all written documents in a safe place away from your work station

Step 16. Update your resume and start looking for another job so that you are prepared in case the situation becomes unbearable, or you are fired without just cause

Step 17. Talk to friends and family
But don't overdo it by repeating the same things day after day, especially if you are not doing anything to improve the situation.

Step 18. Meet with a private, independent counselor, or cleric, to discuss the issue in case friends and family lose their temper

Step 19. Maintain a healthy lifestyle to avoid developing a stress-related illness
Eat balanced, exercise regularly, and avoid consuming addictive substances.
Advice
- Exclude personal issues and opinions from the discussion.
- Keep all comments strictly related to doing a good job for your boss.
Warnings
- People usually don't leave jobs, but their managers. Perhaps you could consider getting transferred to another department.
- Unless something is illegal or potentially costly for the company, managers usually support other managers. If you are new to the company, perhaps it is better if you start looking for something else. If you've been there for years, be cautious before contacting your manager's boss or Human Resources; they tend to support the company that hired them. Keep good documentation to support your complaints and contact outside organizations if it seems to you that things might make your situation worse internally.
- A misbehaving boss probably won't appreciate you writing down what he or she tells you, and may ask you not to. Explain that you need to write to make sure you have understood correctly, to be able to review your notes if you have any doubts in the future, and to add them to the list of goals and achievements.