Professor Trelawney teaches Divination. Ever since we first meet her in Book 3, she has seemed like a right old fraud: she likes making predictions of doom and gloom for the shock value, but she's (almost) never right. However, while Professor Trelawney may be a big faker, we also don't approve of the way Professor Umbridge treats her.
Professor Umbridge clearly thinks that she is a fool and a trickster, so she puts Professor Trelawney on probation before firing her entirely. But Professor Umbridge doesn't try to fire her privately. She decides to humiliate Professor Trelawney by telling her, in front of the whole school, that Hogwarts "was [her] home [...] until an hour ago, when the Minister for Magic countersigned [her] Order of Dismissal" (26.232). Professor Umbridge watches Professor Trelawney's tears "with an expression of gloating enjoyment" (26.234) because she loves picking on people who are weaker than she is, and Professor Trelawney is about as weak as they come.
However, while Professor Umbridge gives herself the right to fire Professor Trelawney (as High Inquisitor), she does not have the right to evict Professor Trelawney from Hogwarts. Professor Dumbledore insists that Professor Trelawney can't leave the school.
Why does he care so much? Because beneath her batty exterior, Professor Trelawney has two valuable secrets. Even though she herself does not seem to remember them, she has made two accurate predictions. The first appears in Book 3, when she predicts that Wormtail will rejoin Voldemort and Voldemort will rise again. The second appears in Book 5.
Professor Dumbledore explains that he was interviewing Trelawney for a job at the Hog's Head Inn fifteen years ago when she suddenly spoke in an unfamiliar, deep voice:
The one with the power to vanquish the Dark Lord approaches ... born to those who have thrice defied him, born as the seventh month dies ... and the Dark Lord will mark him as his equal, but he will have power the Dark Lord knows not ... and either must die at the hand of the other for neither can live while the other survives ... the one with the power to vanquish the Dark Lord will be born as the seventh month dies ... (37.191)
This is the prophecy that drove Voldemort to try to murder Harry when he was a year old. So Professor Trelawney has no trace of the Seer's gift during her day-to-day life instructing students at Hogwarts, but she has occasionally received visitations of the truth apparently without knowing it. As a result, Professor Dumbledore has been sheltering Professor Trelawney at Hogwarts for years, despite the fact that, truly, she isn't much of a teacher.