The president’s failure to deliver on key promises, including taming inflation, weighed on his fellow Republicans in Tuesday’s midterm elections for the House and the Senate.