The massification of artificial intelligence was one of the main forces behind a good year for U.S. stocks.