At first glance, this song seems to be quite personal, a private matter between the psalmist and his Lord. But we always need to remember, in any psalm of David, that he's writing it as the king, so any problem he's having is a problem that affects all Israel, and his own salvation is also the salvation of his people. Any attack upon David himself is an attack upon the Davidic kingdom, right down to and including the kingdom - the Church - of our Lord and Savior Jesus Christ.
What David - and his kingdom - needed to know was that the Lord was right there in the battle with him, that He and his Lord were fighting the on same side against the same enemy. And he needed to know that the Lord was saying to him, "I am your salvation!"
If God answers this prayer, says David, then those who seek his life, those who plot how to hurt him, will be seen for what they are, and they'll be defeated and blown away "like chaff before the wind." What he wants is public vindication, he wants his enemy to be seen falling into the very pit he made for David! That way it'll be a great victory for the justice of the Covenant Lord, and all His people will rejoice with David as he sings, "And my soul shall be joyful in the Lord; it shall rejoice in His salvation! All my bones shall say, 'Lord who is like You, delivering the poor from him who is too strong for him, yes the poor and the needy from him who plunders him?'"
But who is this "enemy" that David had? He says he was a supposed friend, one for whom David himself did only kindness, for whom David, in fact, gave himself sacrificially so as to do him good. Yet when David was experiencing trouble, this turncoat rejoiced and gathered many together to kill him.
With this kind of enemy in mind, then, David asks the Lord, "How long will You look on? Rescue me from their destructions!" And he goes on to say, "just as I'm praying now in the assembly of Your people, so then, when You save me, I'll give thanks in the same assembly! So don't let them win, those who have hated me without a cause!"
Apparently they were accusing him as though he himself were the villain, but he prays that the Lord Who sees all will not be silent, but will make it plain that David wasn't the villain - but that they themselves were the guilty ones. He prays that they'll be defeated, ashamed, and confused.
He prays that all God's people, all those "who favor my righteous cause," on the other hand, will soon "shout for joy and be glad," that they'll be saying, "Let the Lord be magnified, Who has pleasure in the prosperity of His servant." When this happens, sings David, "my tongue shall speak of Your righteousness and of Your praise all the day long!"
How can we apply this to ourselves? Christians are followers of Jesus, and the world sees Jesus, the greater Son of David, as the villain in our day. People see both He and His Church as being obstacles in the way of their "progress." But hopefully, just as in David's case, that Church has been seeking only the good of its enemies. But there comes a time when those enemies must be seen for what they really are, and they must be brought to confusion and public defeat. God's justice must finally be seen by all to prevail. His Church can even now be praying for that justice. Do you? Echo the apostle when he says, "Come quickly, Lord Jesus!"