How Diversification Works in Stock Portfolios