Pikes were effective in the middle age, Alexander's sarissae gave him a tactical advantage over hoplites, why did the long spear decline as a weapon of choice (or use) during the classical period?
The Macedonian phalanx with sarissae proved to be one of the most formidable formations of the Classical world, dominating the European, Northern African and Asian battlefields from southern Italy and Sicily to Greece, modern Turkey, Egypt, Syria and Persia all the way to the western Indian frontiers for about two centuries, remaining totally unbeaten by any non-Macedonian army from its creation in 358 BCE to the Battle of Cynoscephalae in 197 BCE. However, it had its disadvantages. Though practically impregnable when charged from the front, the Macedonian phalanx was very weak on its rear and flanks, mainly because of their very light armor and shield which offered very low protection while fighting in mêlée combat. Light-armed troops like peltasts (javelin throwers), for example, protected the flanks of the phalanx to prevent successful enemy encircling maneuvers.
The wars of the Diadochi, following the death of Alexander and his empire's collapse, resulted in the first battles between identically trained and armed phalanges. However, because the battles of the Hellenistic world relied on the same style army, the same style weaponry, and the same style tactics, battles often ended up stalemated. The Battle of Raphia (217 BCE) between Antiochus III of the Seleucid Empire and Ptolemy IV of Egypt may represent the pinnacle of sarissae tactics when only an elephant charge seemed able to disrupt the opposing phalanx.
The Successor Kingdoms of Alexander's empire tried expanding upon the design, with sarissae becoming elongated in order to gain an advantage over the opposing phalanx, thereby inaugurating an arms race that could only be limited by the phalangites' stamina and the resistance of the weapon itself. The length of the sarissa was increased during the fifty years that followed the death of Alexander, reaching nearly twenty-four feet from the original sixteen feet in the days of Philip and Alexander. The armor and shield of the foot soldiers got heavier through time as well, for their enemies weren't hoplites or Persian light infantry anymore, but other Macedonian phalanges that could reach them with their equally long sarissae. This new equipment was very uncomfortable for combat. The longer sarissa became a problem, the mobility of the soldiers and of the sarissa was now extremely limited due to the excessive length of the weapon. However, mobility and flexibility were no longer concerns anymore as the Hellenistic world used increasingly heavy Macedonian-style infantry. Subsequently, the phalanges renounced both their mobility and their effectiveness against more flexible troops for better efficiency during phalanx engagements. This would prove to be the fatal flaw when encountering the Roman legions and the gladius.
The Hellenistic phalanx also had to fight in perfectly ideal conditions because it wasn't capable of reacting as fast as the earlier Macedonian phalanx. Unlike the earlier Macedonian phalanx, which fought in the harsh climatic and geographic conditions of the East, vastly outnumbered but always victorious, the later Hellenistic phalanx now had a very fragile cohesion. The heavier phalanges faced issues that Alexander's phalanges never experienced, which can only be explained by the fact that their equipment was now too heavy to fight in good order. According to Plutarch, sarissas of sixteen feet seemed light and handy after a very long training but a twenty-four foot sarissa, no matter the intensive preparation of the soldiers, could ever be wielded with ease.
Phalangites couldn't maneuver freely as they used to, their pace was greatly reduced, and they had to fight on perfectly flat battlefields in order to maintain a tidy formation. During the Battle of Pydna (168 BCE) in the Third Macedonian War, the phalanx formation of Perseus of Macedon collapsed because of the uneven terrain on which they were fighting. After pushing back and steam-rolling through the Roman legions, the phalanx had to pursue the retreating Roman infantry on the muddy hillsides behind the Roman army. The phalangites, cluttered by their excessively long sarissae, slipped and disorganized, ending up by being massacred by their more flexible Roman opponents. Such problems do not appear to have ever happened to the phalanx of Alexander that could cross a river (Battle of the Granicus, Battle of the Hydaspes) during battle in good order or adopt risky formations in echelons (Battle of Gaugamela) while later Hellenistic phalanges proved to be, according to Livy, hardly capable of turning around.
In addition, a lack of training and too great a reliance on the sarissa instead of the combined use of arms such as peltasts (Alexander's and Philip's great contributions) led to the final defeat of Macedon by the Romans, thus ending the days of the sarissa and phalanx. Part of the reason for the rapid deterioration of the sarissa's ability was that, after Alexander, generals ceased to protect phalanxes with cavalry and light-armed troops, and phalanxes were destroyed too easily by flank attacks owing to the sarissa's tactical unwieldiness. The sarissa was gradually replaced by variations of the gladius as the weapon of choice with the rise of Rome. Only Pyrrhus of Epirus was able to maintain a high standard of tactical handling with armies based around the sarissa, but with the dawn of the Roman manipular system, even he struggled for his victories.