Investors enjoyed broad gains across major asset classes in the first half of this year, but they endured considerable market swings to earn those returns.