You'd be surprised. When things go wrong, there is always someone that will think 'I could do better' or 'If s/he continues to lead, we're doomed'. All it really takes is some bad actions, and people will want to replace you for either noble or selfish reasons.
Only a shrewd politician can keep his power when things go wrong in his rulership.