I received this through the Comment Form and thought I would answer it briefly for those interested.
Since the battle techniques of the Macedonian Phalanx did not leave it very mobile, why weren’t they outflanked on a consistent basis by their opponents?
The key here is to understand that throughout history most every kind of infantry formation is susceptible to flanking. Armies in the Hellenistic Period were no exception to this. In a style of warfare where everyone is using the same tactics, the weaknesses of the phalanx aren’t as readily apparent. For example, you need to keep the entire line moving in unison or gaps open up which allow an enemy to push through and flank a unit in the line; this becomes harder to do on on rough terrain, so the optimum terrain for phalanx war was flat ground. Hellenistic armies also used cavalry to protect their broader flanks or attack the enemy flanks (Alexander did this to great effect, usually sending elite infantry units, the hypaspists, into the gap made by the cavalry breaking through an enemy’s wing). Here, take a look at this:
What eventually supplanted the phalanx style of war in the Mediterranean was the Roman Maniple System, which was much more maneuverable and flexible than the massed Greek phalanx. You can see a basic representation of this here (ganked from Mike Anderson’s Ancient History Blog):