Republicans were widely expected to win major gains in both the House and Senate in what had been predicted as a “red wave” during this year’s midterms, seen largely as a referendum on inflation, crime and other issues facing Americans during President Biden’s first term.