This song was sung in remembrance of the most perilous time of David's life, the time of the rebellion of his son Absalom. It was a time in which many discontent souls in Israel seized the occasion to join in the rebellion, and David was in peril of his life. In fact, he had to flee Jerusalem and hide at night in caves or in the forest.
We might well ask ourselves why this song, composed in remembrance of the peril of only the one man David, would continue to be used in the worship of all Israel. The reason is found in vs. 8: "Salvation belongs to the Lord. Your blessing is upon Your people" - all the people of God have the same Lord, the same protection, and the same care as David had.
So it is helpful to us as well to read that in the midst of an awful circumstance David prayed for help. He cried out, "Arise, O Lord; save me O my God!" He had confidence that God would hear him because he had many times before experienced such help. All those times came to mind at this moment of extreme need, and he said, "You have struck all my enemies on the cheekbone; You have broken the teeth of the ungodly." So now, in this present perilous situation, he calls upon God to do for him again as He has done in the past.
But by the grace of God this help is not for David only. May we see that no matter what the trouble or trial in life, no matter how deep or perilous, God is absolutely faithful to preserve and bless His people when they call to Him for help. The experience through which David successfully came proves it, and so it should be an example for us all.
See how he sings: "But You, O Lord, are a shield for me, my glory and the One Who lifts up my head! I cried to the Lord with my voice, and He heard me from His holy hill. I lay down and slept; I awoke, for the Lord sustained me!" David experienced first hand the salvation of the Lord in the most difficult of situations, and now he wants every Israelite (and every one of us) to have the same experience - God can be counted on to save each and every one of His people either in - or through - their troubles. He will hear their prayer for help just as He did David's, and He will come speedily to their rescue.
There are two conditions, though, for this kind of help from God. Firstly, those who receive it must be the people of God. He says, "Your blessing is upon Your people." Secondly, they must ask for it. They need to have experienced His grace previously, and they need - trustingly - to pray for the help they need now.
So you and I can count on Him to be our Rescuer. We too need to be the people of God, and we too need to trust Him enough to pray. Will you?