Prime Minister Justin Trudeau of Canada said on Monday that he would step down in the coming months, bowing to an angry electorate at a time of uncertain economic prospects and political infighting.