The election was dominated by Mr. Trump and his relentless focus on Canada. Pierre Poilievre, the opposition leader, lost the seat he had held for 20 years.