Who - David speaking to the LORD when he was fleeing from Absalom.
What - Ultimately it is David’s request for the LORD to rescue him. David is fleeing, he is in danger of being overrun by Absalom’s attackers. He has his wives and children with him, and only a small fighting force. He is in a precarious situation, worsened by the number and who has betrayed him to Absalom’s coup (2 Sam 15 - 17). David knows he is in need of God’s help against all the advisers, and leaders who have become his enemies.
When - At the time David is fleeing Jerusalem because of Absalom’s coup.
Where - Unstated, but from its context and 2 Sam 15-17 I speculate it was either ‘fords of the wilderness” (17:16) or Mahaniam (17:24). David is not in his bunker or palace away from Jerusalem. He is totally exposed.
Why - From 2 Samuel 15-7 we see David was greatly outnumbered and at a political disadvantage. Absalom controls the government and many of the people are backing him. David’s situation was as dire as when he was fleeing Saul. Only God could save him.