At a rally away from the NATO summit, former President Donald J. Trump denigrated the alliance and boasted of berating allied nations as deadbeats.