it's clear to see that after the genius that Hannibal exhibited in the Battle of Cannae, the 2nd Punic War against Rome was very much in his hands. By not deciding to march on Rome, Hannibal may have ultimately lost the war for Carthage and changed the course of human civilization, culture, and language forever.
But why? I've read many things about the possible reasons for Hannibal's hesitance, the strongest possibility being his lack of faith in passing Rome's fortified walls, but is there a more concrete answer to this game-changing question?
Hannibal's immediate goal wasn't to take over Rome itself, immediately. He wanted to separate Rome from it's allies, that way he could way bases of supply for his army. He was isolated in the Italian Peninsula with no way to reinforce his army or re-supply it other than by taking what the locals had because his brother, Hasdrubal, was busy fighting Scipio Africanus in Hispania (Scipio will defeat Hasdrubal and go on to end the 2nd Punic War at the battle of Zama), and his only other immediate ally, the Kingdom of Macedon, was locked in constant struggle with the Aetolian League, who was supported and backed by Rome. Hannibal may have been able to take Rome, but at what cost? It just wasn't worth it, and he knew the juicier prize would have been Sicily anyway, the original area that caused the Punic Wars due to its vast wealth. And really, would taking Rome actually end the war? It wouldn't be the first time to that point that Rome was sacked by barbarians (Brennus, 387BC). The fact that Rome's allies, who loosely to this point maintained slight autonomy and would until the Social War, 90BC, refused to leave Rome's side (Capua is a notable exception, who left Rome, and later paid a very dear price) just showed Hannibal how hard it would've been to conquer an entire foreign land all at once anyway. Hannibal never had the full support and backing of his government at home, and a lot of his army was made up of mercenaries, the congress of Carthage preferred focusing on trade rather than war, and when the war kept dragging on, and it was apparent that Italy was the only front Carthage was winning on, managing to lose Macedonian military support in the Balkans, the destruction of Hasdrubal's army in Hispania by Scipio, and the ousting of the pro-Carthaginian government in Syracuse by pro-Roman forces, Hannibal lost almost all his home-front support. Because the only forces Hannibal was able to raise from local populations was destroyed at Beneventum, his strategy was soundly defeated by the Romans and their allies, who were able to quickly regain the southern parts of Italy, and when Hasdrubal tried to abandon Hispania and march straight for Italy as a last-resort, he was caught at Metaurus, and killed.
/u/Drdickles gave a good overview of the strategic situation at the time.
You may be interested in a couple of related questions I've answered in the past:
Something similar I wrote in response to the question, "How did Hannibal plan to actually defeat Rome?"
If the secret to defeating Rome was detaching her from her allies, then that dictated fighting the war a very certain way and undoubtedly limited Hannibal's freedom of action. In his History of Warfare, Montgomery laid into Hannibal for essentially not laying siege enough, but this misunderstands what Hannibal was doing- with bringing the Italians and Latins into the fold as the goal, he could hardly set about assaulting Brundisium or Beneventum (Lazenby notes that Hannibal's only assaults appear to have been for strategic purposes, like acquiring a port). Once people did come over to him, he then also had to protect them from the inevitable Roman retribution, further limiting him, especially when concluding peace on terms such as he did with Campanians.
Concerning the question of marching on Rome after Cannae, consider the situation. Rome is over 250 miles from Cannae- Hannibal's army normally marched at a pace of about 9 miles a day, maybe 10-15 on a fast march. It would have taken the main force a bit more than Marharbal's five days to get there, and given everything else we know about the Romans, it is highly unlikely they would have just thrown open the gates in despair and surrendered. The city still had substantial defences: two legiones urbanae, 1,500 men at Ostia, the marines Marcellus had stationed at Teanum Sidicinum, and on top of that, all the able-bodied citizens, many of whom would have already seen combat, and the armed slaves. Hannibal had taken noteworthy losses during Cannae and a lengthy siege would have left him vulnerable to being surrounded by relieving forces (gaining the city through treachery, as he did in other cases, is pretty inconceivable here). His forte was pitched battle, not sieges (see how long Saguntum held out). Regardless, if the peoples of (particularly southern) Italy were to be persuaded to defect, how would they feel about his disappearing north to the capital? They had stuck to "wait and see" policies after the Trebia and Trasimene, and may have done so again without the Carthaginian army remaining.
Well, he had no siege equipment and he was in an enemy country which could have raised, at the very least, 20 legions. One legion consisted of around 5000 men in addition to 5000 men from their allies, so that's 200,000 troops. Dodge, via Pliny and Diodorus, claims that Rome could raise 777,300 men (294,000 of those belonged to Rome's allies, so one can understand why Hannibal wanted to detach them from Rome).
Now, even if Hannibal had been in possession of siege equipment, it would not have been strategically sound to simply begin a long siege with enemies threatening your communications and being able to all concetrate on one point - Rome. Maybe the Romans would have opened the gates for him, but most likely they would not have done so and a march to Rome would therefore not have gained him anything.