U.S. equities delivered a modest gain in the fourth quarter, capping a third consecutive year of double-digit returns—an impressive accomplishment given the volatility earlier in the year.