Speaker Kevin McCarthy’s slog to his post ended with a remarkably public show of intraparty strife that played out in a history-making overnight session.