A core sentence of the Psalm is: Deliver me from my enemies.
According to Do Not Destroy.
This may refer to the moment that David had the opportunity to kill his attacker and was encouraged to do so by Abishai, but David refused to comply. “But David said to Abishai, ‘Do not destroy him, for who can put out his hand against the Lord’s anointed and be guiltless?’” (1 Samuel 26:8–9). David was letting God’s justice prevail.
With regards to the historical context of the Psalm, this Psalm could refer to a few incidents in David's life. We should not imagine that David kept some kind of diary. He might have given this psalm this form later on in his life, after experiencing many such incidents. As we see more often, he speaks about an enemy (singular), alternating with many enemies (plural).
This Psalm may be compared with other psalms, for example, Psalm 5:1–12, Psalm 35:1–28, Psalm 58:1–11, Psalm 69:1–36, Psalm 109:1–31, Psalm 137:1–9.
A possible outline (due to the refrain in Psalm 59:9 and Psalm 59:17) is:
Save me from my opponents
(Psalm 59:1–9)Show me your retaliation
(Psalm 59:10–17)
1 Deliver me from my enemies, O my God; protect me from those who rise up against me;