Stocks’ stellar run over the past 18 months has given investors plenty of reasons to celebrate. But it has also saddled them with some of the most expensive valuations in recent memory.