Publius Cornelius Scipio, who didn't acquire the Africanus until after the battle at Zama used strategies he had developed over time specifically to fight Hannibal. He took on board his errors and adapted. For example he used the same Numidian cavalry that Hannibal had used successfully for many years. The realty was Hannibal lost the battle well before it commenced.
Specific factors
Logistics As others have said for the Romans manpower nor supplies were an issue, for all intents and purposes it had an inexhaustible supply of both. It wasn't a question of Rome having an army, it was more an army having a wealthy state.
"Polybius, a keen observer of the Roman military at its height, remarked that “the advantages of the Romans lay in inexhaustible supplies of provisions and men.” The_Logistics_of_the_Roman_Army_at_War_(264BC_-_235AD J.P.Roth
Pre battle preparations Scipio took a large portion of Hannibal's troops out of the battle well before it commenced. In 203BC he killed around 40,000 Nubidians as a by product of his unsuccessful of the Siege of Utica, it was a lucky break but as they say some people make their own luck. The strategy Scipio used were classic Hannibalistic. Use of terrain, stealth, night manoeuvres, fierce fires to create panic and confusion.
"Forty thousand men perished either from the fire or the enemy, over 5000 were taken alive, including many Carthaginian nobles of whom eleven were senators; 174 standards were captured, 2700 horses and 6 elephants, 8 others having been killed or burnt to death. An enormous quantity of arms was secured, these the general devoted to Vulcan, and they were all burnt.Livy Book 30 vi
Diplomacy Scipio was a skilful diplomat, he was by all reports charming and gracious. Hannibal not so much. The Carthaginian senate confronted with Scipio, who by now had quite a few victories to his name outside their front door with a well supplied army in well fortified winter camp camp the Carthaginian senate it is reasonable to assume started discussing terms well before the battle behind the back of Hannibal.
"as winter was coming on he constructed an entrenched camp on a tongue of land which projected into the sea and was connected by a narrow isthmus with the mainland. He enclosed the military and naval camps within the same lines. The legions were stationed in the middle of the headland; the ships, which had been beached, and their crews occupied the northern side; the low ground on the south side was allotted to the cavalry. Such were the incidents in the African campaign down to the end of the autumn, Livy Book 29 xxxv
On the day Scipio tactics were brilliant. He used long thin lines perpendicular to Hannibal's elephants. Knowing the elephants really had only one mode of attack, charging straight ahead as they charged past they were wounded with sharp lances and javelins. Trumpets and flags caused further confusion, some elephants ran amok among Hannibal's left hand ranks. Scipio used Numidian cavalry, the same one cavalry as Hannibal's and it was suggested this made the difference.
"In attack they charged with fiery £lan, but at once turned on meeting opposition ; not, however, to fly, for they charged again and again, riding up into the very teeth of the foe, but never remaining to fight hand to hand with heavier troops. As a curtain for the army in which they served, and as an element to unsettle the morale of the enemy, they ranked among the best of light horse. They were equally useful on level or broken terrain, and were peculiarly clever in taking advantage of the accidents of the ground for ambush or temporary defense. In pursuit they never tired, and here they were the most dangerous of opponents. Like our own broncos or the Cossack horses, their little nags were wonderful for endurance and activity, and throve on food which would kill a civilized horse. On the other hand, they were cruel, reckless and noted for plundering and rapacity. TA Dodge
"by far the best horsemen in Africa." Livy
the Romans allied with the Numidian king Masinissa who led 6000 horsemen against Hannibal's own in the battle of Zama, where the "Numidian Cavalry turned the scales" Fuller, J.F.C., Julius Caesar: Man, Soldier, and Tyrant. p. 28