This psalm is a complaint about being "used" by supposed friends. But it also includes boasting, boasting about a God Who isn't merely "afar off up there in heaven," but Whose hand deals with real affairs down here on earth as well, a God Who really cares and really acts in response to His people's prayers.
These are things every Israelite needed to know each day as he went out into an unfriendly world. It was good for him to hear and repeat the words of this song. And it's good for us too.
David had gone to the Ziphites, thinking that these supposed friends would provide him refuge from Saul's persecutions. He thought he could "lie low" there for a little while until he "caught his breath," so to speak. But the Ziphites saw an opportunity to get favors from the king - maybe a little more tax money for their district. So they went and told Saul that David was hiding out among them.
Obviously the Ziphites hadn't even considered the fact that God's plan was to set David upon Israel's throne and that He would therefore deliver David and at the same time make things go very, very badly for anyone who betrayed him. The temple worshippers sang, "And oppressors have sought after my life; they have not set God before them." It's a common problem in the world: men concoct schemes without any consideration at all of the unseen Ruler of the universe.
But David, later on, after God delivered him and blessed him greatly, remembers this episode, and he leads the people to sing, "Behold, God is my Helper; the Lord is with those who uphold my life. He will repay my enemies for their evil!" He says "behold" because he wrote this song after the fact - people could see that God had indeed been his helper!
Because of such a great deliverance, David could conclude his song on a very joyful note. He sang, "I will freely sacrifice to You; I will praise Your Name, O Lord, for it is good. For He has delivered me out of all trouble; and my eye has seen its desire upon my enemies!"
Later on, when worshipers sang this song to start their day, they could use it to renew their trust in a trustworthy God. They could leave the service of worship with confidence that it didn't matter what man did to them that day, because God's plan for them would always be fulfilled!
Does He have a plan for you? If you trust Him today, if you love Him and desire to serve Him today, then He DOES have such a plan! And NO scheme of man can overthrow that plan!