The technology and consumer discretionary segments of the S&P 500 have propelled the broader market’s rally from its 2022 low in mid-June.