Why pikes? But also, why not pikes?
I have been thinking lately on melee combat for fantasy writing purposes, and it struck me that pikes have seemed to dissapear and reappear several times in history. First was in the greeks, who realized that their phalanxes would do better with longer spears until they arrived to the Macedonian phalanx, which was defeated by the more versatile roman heavy infantry. Then pikes make a dissapearance from history until the late medieval/renaissance/early modern period, where they replace the swiss style halberd-block (barring some special occasions, like the battle of Flooden when english billhooks cut scottish pikes) and had their biggest proponents as the spanish tercio, until they were eventually phased out for bayonet infantry.
My question is then, why was it that the pikes didnt come back _sooner_ in ancient/medieval warfare, having demonstrated their previous effectiveness against shield walls, the most prevalent medieval formations, and cavalry, arguably the biggest danger of medieval combat. And then, when it WAS reintroduced, why didnt more flexible infantry formations defeat it like before?