The S&P 500 is expensive by most broad measures, but a deeper look tells a different story and presents an opportunity for long-term investors.