David had many hard times. Before becoming king, he was pursued by Saul, who sought to kill him. He fought many battles with countries opposed to Israel. He suffered through rebellions, including one led by his son Absalom, who actually deposed him and sent him into exile for a while.
In one of these trying times, He wrote this Psalm as a cry. He is the innocent man suffering persecution from evil men. To make it worse, God has yet to come to his rescue despite his prayers. So, he cried out in verse 1, why have you forsaken me, why are you so far from me?
David characterized his enemies as those who scorned and despised him. (6) They ridiculed him for trusting in God. (8) They were powerful, like bulls of Bashan (12) Bashan is the area north of Israel, given to Mannassah, which we now call the Golan Heights. It was known for great pasture land that produced large cattle. It became a symbol for powerful enemies from the north. They were aggressive predators, like dogs who encircled a vulnerable person. (16) Dogs in those days were not pets, they were more like jackals or coyotes. They plotted his downfall and how they would divide his possessions, down to his very clothes. (17-18)
David had exhausted his own strength, too. His heart melted, his strength dried out, he had nothing left. He was desperate. (14-16) Yet, David still believed and worshipped God. He declared God as holy. (3) He remembered that God called him into faith and made him trust in him. (9-11) David was suffering, but he expected vindication. He expected deliverance.
Many of us have experienced trials. We cried out to God. And we waited. Some years ago, I experienced a situation that made me identify with David. People conspired against me to take me out of my work position so they could make more money. Ironically, these people claimed to be Christians. They manufactured a lie and sold it to others. I did lose my position, although I kept my job. Ultimately, I was asked to prepare my version of events and present it to my boss, who vindicated me and recognized the falseness of the allegations.
During that time, I identified with this Psalm, and others, greatly. I resolved to trust in the Lord and not fight back. I opened my Bible to this Psalm and left it on my work desk until the day I had to leave that office. I read those Psalms every day. I asked God to vindicate me.