CEO's of publicly traded companies normally have a large portion of their compensation rolled into stock options. As they manage the company well, the worth of those stocks grow. That is why at the end of the year many of them show such large incomes because the value of those shares are measured according to their growth over the fiscal year. If a CEO under performs and is let go, usually he is given parting compensation that is a portion of the increase in the value of the stock from the time the CEO started to when the CEO left. The same stock is then given to the next CEO. Even if the company underperforms compared to forecasted gains, the stock usually still gains worth, just like the entire stock market continues to grow even though there are peaks and valley in the short term.
So, CEO's are compensated usually for how they perform.