In Donald Trump’s first term as president, the federal courts were a key battleground as judges blocked or slowed many of his administration’s policies, playing an outsized role in whether or how they were implemented.