Mayor Adams’s campaign was left foundering after repeated scandals, a federal indictment and his courtship of President Trump.