BREAKINGImageJohn F. Kelly, the president’s chief of staff, was brought to the White House last summer from his post as secretary of homeland security.CreditCreditDoug Mills/The New York TimesBy Michael D. Shear and Julie Hirschfeld DavisWASHINGTON — John F. Kelly, the retired Marine general tapped as chief of staff by President Trump last year to bring order to his chaotic White House, will leave the job by the end of the year, Mr. Trump said on Saturday, the latest departure from the president’s inner circle after a bruising midterm election for his party.Mr. Trump, speaking with reporters on the White House lawn before departing for the Army-Navy football game in Philadelphia, said that he would announce a replacement for Mr. Kelly — perhaps on an interim basis — in the next day or two.“John Kelly will be leaving — I don’t know if I can say ‘retiring,’” Mr. Trump said. “But he’s a great guy. John Kelly will be leaving at the end of the year.”The leading candidate to replace Mr. Kelly is Nick Ayers, Vice President Mike Pence’s 36-year-old chief of staff and a Republican political operative, who possesses the kind of savvy about campaigns that Mr. Trump has craved. Mr. Kelly, a career military officer before becoming Mr. Trump’s first homeland security secretary, lacked such experience.Mr. Kelly’s coming departure leaves Mr. Trump with an ever-shrinking team of close advisers as he begins to navigate the new power structure on Capitol Hill that will be ushered in next month when Democrats assume control of the House.The chief of staff’s exit also adds another prominent name to the list of core advisers who have left after trying to manage the president through his nearly two years in office, often finding themselves shunned and sidelined for their efforts.Although the president had made a display of saying that Mr. Kelly, 68, would stay through the 2020 re-election effort, the chief of staff was blunt with several people in the White House that he planned to make it only through the midterms.Presidents typically make changes in staffing after midterm elections. During a wide-ranging news conference the day after the vote, the president deflected questions about the job security of Mr. Kelly and Jeff Sessions, the attorney general at the time. Mr. Sessions was forced out later in the day in a Twitter post.“People leave,” Mr. Trump said at the time, adding that he had not heard anything about Mr. Kelly leaving.“It’s a very exhausting job — although I love doing it, I must tell you — but it’s exhausting for a lot of people,” Mr. Trump said. “I’m surprised that a lot of people, they start off, they’re young people. They’re there for two years, and they’re old by the time they leave.”[You’re fired: A look at turnover in the Trump administration.]Mr. Kelly’s resignation had long been rumored, amid signs that he and Mr. Trump had grown irritated with each other. The president — as freewheeling as Mr. Kelly is methodical — privately fumed that he thought his chief was hiding things from him, and frequently upbraided him in the West Wing on matters large and small.The chief of staff, who often said privately that he did not believe that Mr. Trump appreciated or understood his own job, had taken to telling colleagues “I don’t need this” after such criticism from the president.Yet for months, the dysfunctional dynamic continued without a firing or a resignation.Katie Rogers and Eileen Sullivan contributed reporting.