The overture came soon after the Trump campaign was told of Russian “dirt” on Hillary Clinton. As Donald J. Trump neared the Republican nomination, Moscow tried repeatedly to contact his campaign.