Once you raise a few rounds of capital, your equity ownership most likely gets diluted to a minority stake. There is nothing that stops the board from firing the founder at this point. How do you mitigate that risk and still be able to raise those rounds?
1) Don't do anything worth being fired for.
2) Understand how the CEO role changes at different company stages, and have a plan to either grow at every level, or shift to a role that better suits you.
Most investors aren't out to replace you, and definitely don't want to kick you out. But you do need the best person for the job at the head of the company at all times. You can either:
It's a difficult transition, one way or another. Check out http://startupmanagement.org/lexicon/founder-to-ceo/ for a lot of good reading from founders and VCs.