The Classical Greek Phalanx was a huge success. It was copied by the Romans, the Etruscans, the Macedonians, and for centuries; the only army that could defeat a phalanx was another phalanx.
The Romans used the Phalanx formation until they ran into the Samnites, a hill tribe to the west of Rome. Under Marius, the army was reorganized into more mobile formations called maniples. Their weapons were also changed.
The first battles against Piero were losses, but they inflicted a huge cost on his army. Not long later, when the Romans started battle in Greece; they wiped the floor with the Greeks.
The Greeks were excellent at small, pitched battles. The Macedonians, under Philip then Alexander brought in the organization and siege warfare that led Alexander conquer the world. The Greeks were terrible at siege warfare because of the small logistic base that the armies had, not to mention that they were citizens & farmers. They relied upon treachery to take cities. For example, the Spartans never breached the walls until a group of aristocrats opened the doors to the city & brought an end to that war.
The Romans excelled at logistics. They built walls to pen in those they were besieging, like at the end of G. Julius Caesar's Gallic wars, and a century later at Massada in the Judean desert. They built roads, aqueducts, and even built a fortified camp each night when they were outside the city. Failure to build that camp lead to one of the defeats at the hands of Sparticus.
For 20 years, Hannibal defeated everything the Romans threw at him. But the Romans kept coming. the Romans suffered massive defeats against Veii, against The Greeks, against the Gauls; but still- the Romans kept coming.
Enemies of Rome even hired former centurions to train their men in the ways the Romans fought. same equipment even. And yet, the enemies never mustered a force with the power of a Roman Legion.
Clearly, the Romans were the better military power.