μένειν is not a complementary infinitive to φεύγουσιν.
τὸ . . . μένειν is an articular infinitive--an infinitive with a definitive article, i.e., an infinitive used as a noun, and it's the object of the preposition διὰ: "because of the remaining" or "because of the fact of remaining."
The articular infinitive has a subject in the accusative, τοὺς πολεμίους, and an adverbial modifier, ἐν τῇ χώρᾳ.
So, we have an articular infinitive phrase: διὰ τὸ τοὺς πολεμίους ἐν τῇ χώρᾳ μένειν -- "because [of the fact that] the enemy is remaining in the country".
This articular infinitive phrase modifies the main clause, φεύγουσιν οἱ πολῖται -- "Because the enemy is remaining in the country, the citizens are fleeing."
The articular infinitive is one of the many ways the Greek article can be used to turn just about anything into a noun.
Hope this helps!