1 Samuel 26-31, Recapping
David was in area of Carmel, (not Mt. Carmel), south of Hebron, near desert of Paran (west of dead sea).
Strategic Situation of Israel
As a Benjamite, Sauls tribe is known for particularly strong fighters among Israel. They are the smallest of the tribes having nearly been exterminated shorty after Joshua's death (roughly 400+ years before Saul), and are geographically surrounded by the land of Judah around them. Consequently while Sauls power base is Benjamin and his capital Gibeah, just north of later Jerusalem (Jebus) much of Saul's military strength derives from Judah with the ability to call from the other tribes as needed.
Gibeah is Saul's capital. Saul is still in Gibeah, 1 Sam 26, before he receives intel from Zephites that David is on hill of Hachilah, "before" Jeshimon (a barren, waste area on the West bank of Dead Sea).
Saul leads 3,000 into Zeph Wilderness to pursue. After David sneaks into Saul's camp then taunts/chastises Saul's army for not protecting him properly, Saul returns to "his place" (likely Gibeah) and David "continues on".
Note: 3,000 soldiers are likely the forces which can easily be called up quickly from among fighting age men local to Judah and Benjamin. This is likely not a full mobilization. It may indicate that armies in those days for major conflict would be typically in the low tens of thousands, while the raiding parties of Amalekites may be in the low thousands.
David could now be heading East, away from to other side of Jordan, as referenced by having to "cross over" (the Jordan) to head West. "Crossing over" could refer to the territory of Judah, although it puts David at risk taking his forces anywhere near Saul's.
David changes mind and seeks refuge in Philistines lands, and so "crosses over". Refuge is with Achish, son of Moach, king of Gath, part of Philistine confederation, one of the five major Philistine city-states (Gath, Ashkelon, Ashdod, Gaza, and Ekron). Saul discontinues tracking David once he hears he is out of reach in Philistine territory.
David and band initially live in the royal city of Gath, each soldier allowed his own "household". David, perhaps preferring to avoid the scrutiny of the Philistines and maintain independence, asks the king for a city in Philistine territory. Gath and Ekron are the two nearest Judean land, while the other three are directly on the coast, with Gath being the closest geographically to Judea and therefore the first to see battles with Israel.
Achish, hoping to put David's alientation to use against the Israelite enemies, gives David the town of Ziklag on Judean march, near the Negev (the southern desert areas) where the Amalekites live. David's base will be Ziklag for 1 year, 4 months.
David lies constantly to Achish about raiding Judeans, Jerahmeelites, and Kenites in the Negev. Achish is then convinced that David is such a rabid enemy of his own people that he has no place to return among them and is a proper vassal of Achish. To his mind, David might even make a suitable vassal king one day once if Saul is finished.
Note: the Philistines may colonize cities but appear to prefer to stay in their coastal cities, so long as enemy kingdoms do as they are told, are not a military threat, and pay tribute. They do not appear to take prisoners in general (excepting high value prisoners like Samson), unlike the Amalekite raiders.
After the events of 1 Sam 15, Saul may have pacified Amalekites sufficiently that they were not a high threat to Saul's kingdom, as evidenced by at least one Amalekites fighting with/for Saul at the Battle of Mt. Gilboa. They may have laid low but only recently become emboldened by new fighting between the Philistines and Saul, reversing the defeats of 1 Sam 14 with Saul and Jonathan and 17, 18, 23 under David.
David begins raiding and destroying Israel's enemies far from Philistine land, exterminating conquered so reports don't get back to Philistines. David raids often in Geshur, brings back spoils to Achish who doesn't ask difficult questions and takes David's word that the spoils come from Judean March.
Option: Geshur in the Golan (Northern Theory)
A kingdom/territory of Geshur is commonly recognized in modern Golan.
With the blessing of Gath, David may transit the Shephelah and Jezreel valley to access Golan but this would risk discovery passing so close by Gath. David *could* be transiting via Moab or on Western side of Jordan/Dead sea to access Golan. David has family in Moab and sent his parents there for safety (1 Sam 22). May maintain connections dating back to Ruth's day (great grandmother). In this way David's expeditions could be seen to be returning from the direction of the Negev and be believable to Achish.
Option: Geshur near Egypt (Southern Theory, Preferred)
1 Samuel 27:8 states "Now David and his men went up and raided the Geshurites, the Girzites and the Amalekites. (From ancient times these peoples had lived in the land extending to Shur and Egypt.)" This strongly places Geshur near other groups known to be in/near the southern Negev wildnerness although this Geshur has yet to be solidly located. This makes more sense of where David is best positioned and how he can raid easily and be seen by the Philistines to be raiding in the expected direction. (Leaving for days at a time to raid in the North, skirting Saul's kingdom, would be a feat, difficult to keep quiet, and there would be less pressure to slaughter everyone since those in the northern kingdom would be less likely to be in contact with the Philistines anyway.)
NOTE: The Philistines, Amalekites, Israelites all appear to speak a common tongue. Foreigners among different groups are not uncommon (i.e. the Amalekite in Saul's army who notes he is considered foreigner, and foreign men of renown among David's inner circle, the presence of Anakim Nephilim like Goliath and others whose ancestors took refuge from Joshua/Caleb and evidently continued some semblance of a distinct bloodline).
Achish reassures a bloodthirsty David that when the time comes to exterminate Saul, David will be by his side with his forces. Achish names him part of his permanent bodyguard without evident reservation and is loath to part with him. Of note: David was once part of Saul's bodyguard.
The Philistines mobilize near Aphek, which is the same place as where the Philistines captured the ark in the days of the High Priest Eli before Saul became king. Aphek is within one day's march, west from Shiloh where the tabernacle was often. It is along the southern branch of Yarkon river, heading up to Judean foothills.
David's Detour
Note: Chronologically, Chapter 29 appears to happen BEFORE chapter 28 and is somewhat of a sidenote explaining what happened to David; how he was not at the Battle of Mt. Gilboa.
David is intially part of the muster at Aphek bringing 600 men to the Philistine's side. The other Philistine lords have heard the Israelite songs of "David has slain his ten thousands" (referencing Philistine losses) and wisely insist he stay behind lest he turn against them in the heat of battle and earn his way back into Saul's good graces with Philistine blood.
Achish is conciliatory in ordering David to leave the army and return to Ziklag, which is either a 3 day march away (or this more likely represents the total time that David was away at the muster). While David was at Aphek, Amalekites raid Negev and Ziklag and take the whole population alive as captives.
This suggests the David essentially left Ziklag defenseless and invites the further question that, if he had gone with Achish to Gilboa and only then fought on Saul's side, what was his plan with all of the women and children left at the mercy of a defeated and vengeful Philistine people?
David's army wants to stone him. David's army has Abiathar the priest with them, who conveys God's blessing on a pursuit. David's already travel-exhausted army executes a forced march in pursuit of Amalekites. 200 can't continue and stay at Besor brook ford, while 400 continue on.
They find an Egyptian slave dying of thirst/hunger, left behind by an Amalekite master. Interrogated, he extracts a promise of safety from David (not to kill him or return him to his master).
That the Amalekites took Ziklag and killed no one, but one of their chiefs left behind the dead weight of a sick servant, suggest 1) return speed was essential and 2) in killing no one from Ziklag and taking them all captive, none of the captives were deemed similarly dead weight and left behind or killed on the way. Thus most if not (likely) all of the inhabitants of Ziklag we're mobile and did not consistent of aging relatives. As David left his parents in Moab, his small army took only those who could move easily while evading Saul.
The Amalekites are found spread out and gorging themselves, all slaughtered except for 400 camel riders. Since the 400 are apparently a minority, David's army of 400 was likely very outnumbered, even if they had the advantage of surprise and a dulled opponent.
David shares the spoils with the 200 left behind despite protestations of the 400 who had done the fighting. Shares spoils with towns of Judah (some were raided), which are now indebted to David, and to the towns in larger region, especially places which sheltered David. This only likely increases their eagerness to later recognize David as king after Saul's death.
Philistines on the Move
From Aphek the Philistines do not go east into the Judean hills to destroy Israel but turn north, likely passing Megiddo into the Jezreel valley, taking the same more gradual sloping path that later Assyrians and Romans would to assault Jerusalem. This may indicate that the direct route up from the plains was heavily defended or otherwise not viable. The "Shaaraim road" from Gath going east was an earlier point of access into the hills that was possible while the Philistines had significant control, and was also their route of retreat following David's killing of Goliath. They would not take this road again.
If you avoid a handful of dangerous eastward approaches into the hills from the coastlands, the remaining and easier points of entry lie heading south from the Jezreel Valley. Thus later kings like Solomon would heavily fortify access to the hills from the Jezreel. At this time, Megiddo is not a significant factor.
Thus, Saul either moved into Jezreel to counter the observed Philistine intent or he already believed they would have to use that route up into the hills. Philistines encamp at Shunum (on the south side of a hill north of Mt. Gilboa, with En Dor on the north slope) in response to reports of Saul in Jezreel, while Saul has camp near Jezreel spring (strategically near a water source? same as Spring of Harrod?) at the foot of Mt. Gilboa, with the ability to retreats to defensible heights. Saul's army consists of soldiers from both Western and Eastern sides of Jordan. Eastern soldiers came over from the fords east of the Jezreel Valley from Gilead and Gad (etc.)
Saul sneaks north around hill occupied Philistines to consult the witch at En-Dor, hence the disguise of himself and 2 bodyguards, not from the witch principally but rather disguised from the Philistines.
The Battle of Mt. Gilboa
The battle in Jezreel goes against Israel; Israel flees to safety of higher ground. In the middle of fierce fighting Saul is hit by arrows from archers and mortally wounded. This indicates safe spots for archers to fire from and clear distinctions of soldiers to identify targets. Israelite army may be fleeing and these are likely chariot-transported archers pursuing fleeing pockets of soldiers, as the Amalekite soldier recounts in 2 Sam 1.
This may indicate a successful flanking effort of the charioteers around the infantry fighting or an infantry breakthrough in the lines that the charioteers exploited to get through to attack the Israelite leaders. Saul dies next to his sons. The battle (or simply mop-up) continues a little longer since the chariot soldiers can't or won't get to king's body immediately but arrive only next day for looting (looting would not be feasible at night).
Additionally, the high ground may be safe enough from chariot-born attackers, beyond shooting arrows at range. The Amalekite soldier, as a part of Israel's army, knows who the king is, knows who David is, knows of the rivalry and is evidently close by enough to see king and bodyguard fall, but secure enough to retrieve royal crown and armband and flee to safety. The Amalekite confirms that Saul appeared mortally wounded before final death. He may even have been close enough to hear Saul's request to armor bearer and attempted to capitalize on it to win favor with David.
Saul's death seals the Philistine victory and causes a general route of rest of Israel's army. The cities are apparently abandoned (maybe all the cities in the Judean hills, at least temporarily or just the cities around Jezreel). Beth-Shan is likely abandoned with residents retreating accross the Jordan where possible. The Philistines may remain in revelry and celebration of their victory and not be vigilant at night. Saul's beheaded body (and those of his sons killed with him) is put on the wall as warning to Israel against further activity. Beth Shaan is apparently insufficiently guarded, so men from Jabesh Gilead are able to sneak in at night to retrieve the bodies, which are cremated instead of buried. This could indicate rare, local custom, or more likely the uncleanliness of the desecrated bodies which necessitated ritually burning them instead of burial. Jabesh Gilead then mourns/fasts for 1 week after Saul's bones are buried.
The Philistines take the head of Saul and fix in in the temple of Dagon (the city in 1 Chron 10 is not named, however, in Judges 16 Samson destroys the temple in Gaza) and displayed his armor in temple. Sauls weapons passed through all cities of Philistines.
Presumably most/all of Saul's fighting-age sons are at this battle. Saul is backed up onto the heights of Mt. Gilboa. He is possibly separated from his highly-capable commander, Abner, and a son, Ishbosheth. Abner and Ishboshether evacuate to the Jordan fords, escape across, and head south towards Gad. Cut-off from capital and homeland (Benjamin), Abner instates a new capital in Mahanaim, with Ishbosheth as the king, in the hills on the eastern side of the Jordan, south of Gilead, in Gad's territorry, far from Philistine Reach.
That David will leverage a base of support and take many army officers from Judah suggests that the Philistines don't press the war into the Judean hills. David likely enters these hills directly from the coastal/plain areas (that the Philistines avoided). That Abner and Ishbosheth do not return to their homeland of Benjamin suggests that they are practically cut off from access, perhaps by a continued Philistine presence in the Jezreel where fords are easier and the Dead Sea valley in the south. Thus, Judah is left to David to establish his competing throne.
Ishbosheth is king East of the Jordan leaving an effective power vacuum in the Judean hill region that David will fill immediately.
Some of Saul's younger sons and grandsons remain alive, likely in Gibeah; likely too young to accompany their father to the battle. Under David's effective control, he will turn them over to Gibeon to sate God's anger for the genocide Saul intended towards them.
Of Interest: Philistines and Amalekites
Amalekites appear to be somewhat of a barbarian people living in the Negev desert. They are frequently seen as raiders, destroying and despoiling, but not staying in conquered territories. They take captive/slaves back into their territories. No cities of theirs appear to be named in the Bible. They maintain long generational grudges and enmities. In 2 Samuel, they are mentioned in context of camel riders, reinforcing desert/wilderness adaptations. Their final (general) destruction will come only Hezekiah's despite Samuel's admonition to Saul to exterminate them wholesale. Hamman the Agagite (descendent of Agag -- probably a title rather a name), likely a descended of a royal Amalekite line, will turn up in Persia to threaten Esther's people one last time.
The Philistines set up their home in the coastal and sloping plain areas. While they can range far from their cities and even colonize outward (where easy), their preference seems to be to stick as much to their major cities and can be pushed easily out of conquered lands the farther away from the homeland they are. Their cities are established and they have a confederation-style coordination between independent city states. In contrast to the Amalekites, they maintain horses and chariots, suitable to warfare on plains and efficient deployment of infantry and archers into battle. Horses at this time are still not yet well bred into the shock cavalry or armored chariots styles which will come later.
The Philistines are still not the Imperial peoples which will come later (i.e. Assyrians, Babylonians, etc.) that extend their territory and cultures into foreign areas, maintaining presences specifically to dominate and assimilate the new peoples. They do not generally take captives but prefer to eliminate the elements and practices of subject peoples that could later pose a threat (i.e. blacksmiths, weapon crafting, etc.).
External References
www.esv.org/resources/esv-global-study-bible/map-09-08/
https://www.academia.edu/43548069/Talmai_King_of_Geshur