Rome recovered because if its literally unmatched in the ancient world ability to recruit armies and put orders of magnitude more men in the field as a portion of their population.
Hannibal never marched on Rome because he knew he could never take it. Doing a siege in the area most loyal to Rome would have been suicidal for his force.