The president and his advisers underestimated Democratic voter anger, leading to Republican regrets.