Sometimes it was out of his control, in other times it was depending on circumstance.
For example, in book 1, <PERSON> was the teacher. He was a teacher in the past but because <PERSON> (who cursed the DADA post so no one would last more than 3 terms) was possessing <PERSON>, he was able to stay longer than others.
In book 2, <PERSON> is the teacher. This is because no one else wants the post, not because <PERSON> wanted him in particular. We also learn that the job is essentially cursed.
"He was the on' man for the job," said <PERSON>, offering them a Y plate of treacle fudge, while <PERSON> coughed squelchily into his basin. "An' I mean the on' one. Gettin' very difficult ter find anyone fer Y the Dark Arts job. People aren't too keen ter take it on, see. 417
They're startin' ter think it's jinxed. No one's lasted long fer a while now. -Chamber of Secrets
In book 3, chances are looking slim for a teacher, but <PERSON> (a werewolf who people are reluctant to employ) gets a chance by <PERSON> to teach. He was by peer judgement a very good teacher (approved by Madam <PERSON>, students, and teachers).
In book 4, the Triwizard Tournament takes place, and as <PERSON> points out that <PERSON> is reading the signs, gets Mad eye <PERSON> to take the post, just for 1 year (pointed out to be an teacher experienced in his field even though he turned out to be <PERSON> and placed illegal curses on his students)
If it hurts again, go straight to <PERSON> ­ they're saying he's got Mad­Eye out of retirement, which means he's reading the signs, even if no one else is. Goblet of Fire
In book 5, it is in the same position as Book 2. No one wants the job, with the public considering it cursed, however, this time the ministry intervene and force <PERSON> to employ a ministry witch (<PERSON>) in essence to spy and cause trouble at Hogwarts.
In book 6, <PERSON> needed <PERSON> in order to obtain a memory, and as <PERSON> taught potions, <PERSON> had to move to the vacant role he so longed for (DADA). <PERSON> also knew he was going to die, so gave <PERSON> his wish at teaching DADA knowing that he would play a larger role when <PERSON> goes in the school anyway (technically <PERSON> didn't last longer than 3 months either, he left before the end of the last term, and came back as a headteacher).
In book 7, <PERSON> was inactive due to being in the afterlife. Not his fault! 194