Can I resign?
This is a very hard question to answer. I usually ask a few questions before providing a response - do you want to? Why? The first thing you need to do is look in the mirror and ask why you want to leave. If you can convince yourself (or maybe your spouse or another trusted person in your life) that you are not being treated fairly and need to leave, then you should start to plan a departure. Don't make a hasty decision. With few exceptions, you can't take back a resignation, and if you have access to sensitive company information, your departure may be hastened if your employer perceives any threat of disloyalty.
Practically speaking, the problem with resigning is that the law does not encourage it. With few exceptions, a resignation means forfeiting your right to unemployment, recovery for having to leave the workplace due to harassing behavior, entitlement to any unpaid bonus compensation (even earned) and/or a severance payment. Why are people forced to endure unfairness? If I had a dollar for every time I answered this question, I'd be a rich man. Public policy encourages employment, even if this creates hardship for some.
If you must leave the workplace, consult with an attorney about the best way to go about it. If you are leaving due to workplace hostility, you will need to know (1) what you are allowed to remove from the workplace, (2) what you should say/do on your way out and (3) what type of treatment and compensation you can expect from your employer after you resign.