MANCHESTER, N.H. — In his first rally since the Senate acquitted him on charges that he abused power and obstructed Congress, a triumphant President Trump returned on Monday to New Hampshire, the state where he won his first primary in 2016 and that he hopes to carry in 2020.

At a rally in an arena that top officials billed as something of a homecoming, Mr. Trump’s crowd erupted in vintage chants of “Lock her up!” when he referred to Speaker Nancy Pelosi’s behavior at his State of the Union address last week, when she tore up a copy of his remarks after he finished. “I’m speaking and a woman is mumbling terribly behind me, angry,” he said. “We’re the ones who should be angry.”

But Mr. Trump also credited Ms. Pelosi and the impeachment trial for an increase in his poll numbers. “Thank you, Nancy,” he said.

Mr. Trump and his top campaign aides made it clear that their immediate goal in coming to Manchester on the eve of the New Hampshire primary was to steal attention from a competitive Democratic primary in which Senator Bernie Sanders of Vermont and Pete Buttigieg, the former mayor of South Bend, Ind., are running almost neck and neck in many surveys.