At least in economic theory, a company does not give out dividends if it believes that it can get a better return on its cash (in terms of profit) than the investor can in the overall market.
But, companies must eventually give out dividends. There's a certain point at which the company's cash hoard gets so large that investors become unhappy (see Microsoft).