Um… They survived because Neo lost to Smith, got assimilated, and because he was connected to the main servers, they managed to wipe Smith off the platform, restoring the Matrix to a previous save.
The machines wiped out Smith, and what I wrote is still correct. So... um yeah.