You likely want to be at an institution and department that values you and wants you to be in their orbit. But sometimes you do not get promoted, or perhaps not tenured, or perhaps not an appropriate raise or salary. You may well appeal or otherwise voice your concerns.
But perhaps you should find a place where you are valued. Even if your current department/institution is treating you unfairly. Appeal, surely. But at the same time look around. In fact, you ought be looking around regularly if you feel the match is not for you. You may have to give up prestige, you may have to give up salary, you may have to move to a place that is not ideal for you locationally. But you may find that your new venue relieves your sense of being treated inappropriately, and that you like being appreciated. Your former institution and colleagues may be pleased you are out of their hair, or regret their lack of attention to your strengths. But this is of no matter--
What's crucial is that you thrive and are comfortable.
If in the end your original institution changes its mind, at least you have an alternative in mind.
I observe that finding a new venue proves good for most such cases.
Say that you cannot find a new home, and you can stay where you are now. Focus on what's important, be civil and uncomplaining, and not let them control you. In fact, you might want to exceed their expectations for your ability to go in your own direction.
The trick is to focus on what matters in your work.