Friendship with the owner, knowledge that he will never get a job anywhere else in the NHL without help from Lowe, a complete lack of self respect in order to willingly take a humiliating demotion after his abject failure in the head job, and strong sycophantic abilities to reintegrate into the incoming regime to the point he's pretty much Chia's right hand man.
That should pretty much cover most of the reasons why he's still employed.
Mactavish did the job he was hired to do which is to get us high picks until the arena was ready while making it look like it was incompetence.
The team looked like it was on the upswing before Mact was hired, and he was quite clearly brought in to brought in to reap the glories of the expected incoming success. It's reflected in his signings(all big money/win now type deals), and his quick demotion once the full measure of his inability was known(which is unusual for the Oilers, suggesting the plan was to win, not wallow).
It was straight up incompetence, saying they were intending to make it look like incompetence would be giving them waaaay too much credit.