v1-2: Ziklag (Josh 19.5; 1 Chr 4.30) belonged to Judah. It had been captured by the Philistines, and then given to David (19.5); thus Achish's gift, which should have belonged to Israel anyway, became worthless.
Amalek was a descendant of Esau; and was profane, interested only in material things, and had been cursed by God (Deut 25.17-19). In 15.1-3, Amalek had not been destroyed by Saul. Now, they caused problems for David. We see that the failure of one person had consequences for another.
With both the armies of Israel and Philistia far to the north, Amalek took the opportunity to invade the south. Yet no one was killed in Ziklag; another sign of God's overruling. Later, all was recovered.
v3-6: The arrival of David and his men was traumatic. Having marched many miles, they found their loved ones captured. David suffered with his men, with Ahinoam and Abigail being captured. The men blamed David for their loss, and even spoke of stoning him.
David had lost his security with the Philistines, and now his security at Ziklag. He could not speak with Samuel or Jonathan, and his family was far away in Moab. He strengthened himself in God, who would never disappoint.
v7-8: David took the opportunity to seek the will of God. Unlike Saul, David heard God's voice, with a clear promise of victory.
v9-10: David arrived at Besor, having marched for three days from Aphek (29.1).
v11-15: God's overruling, in that David found an Egyptian slave who had survived for three days without food and water. He had been abandoned by his Amalekite master, having fallen ill. He was able to lead David to the Amalekite camp.
v16-17: The victory was promised, and was accomplished. Yet victory required effort and commitment, as David fought for a whole day. For his 400, this was a mighty victory, as the Amalekite army seems to have been much larger.
v18-20: David's victory included the recovery of everything they had lost.
v21-25: David's army shared the spoils of victory. Some wicked men amongst his army wanted to deprive the 200 who did not join battle of the spoils of victory.
The presence of such men in David's army is an indication of the mixed multitude that often follows a powerful leader. In contrast, Saul had chosen the best men of Israel (8.11; 14.52), yet his army would be defeated.
David made a distinction between weariness and half-heartedness; and he condemned the attitude of selfishness (Phil 2.3-4). His gracious action was reflected in the new practice of sharing the spoils of victory. This was important, as David would win many battles as king of Israel.
The N.T. has a similar principle; John 4.36-38; Acts 4.23-24; 15.4.
v26-31: David generously gave to others. Perhaps he had received gifts from these towns during the period he was fleeing from Saul. It is consistent with his care for Nabal's men and livestock (25.7-8). It seems that whilst David lived in the wilderness of southern Judah, he protected the various towns from Gentile attack. Once he went north, Amalek took advantage of his absence (v14). Perhaps for the first time, David was able to return the material kindness that others had shown him.