The midterm results exposed deep opposition to President Donald Trump’s war against Iran, complicating his options as he struggles to end the conflict he initiated.