This song is for all who are deeply distressed, for those who have prayed and prayed again, but who haven't seen God's hand of mercy yet. To them it seems as though God has hid His eyes from their problem. That notion has made the distress ever so much worse.
David had had experiences like that. He'd been in dangerous situations brought on by enemies who sought to defeat him and be rid of him. The situation had been made much worse by God's seeming indifference to his prayers. But then, after more distress and more prayer, God had blessed him and then, when the problem was past, David wrote and introduced a psalm like this one into the songs of Israel's worship. He knew that all of God's people have problems to which God seems indifferent sometimes, and he wanted them to enter with Him into the realization of God's care for them. Even if the problems were not always with foreign enemies, yet there was always their - and our - common enemy the Devil.
David's example makes it clear that it's important at the outset for the worshipper to be extremely honest with Jehovah about his feelings. He needs to admit that he feels like God has ignored him, ceased to protect him, and, apparently, has cast him off - and he needs to say so.
Our prayers, too, should be honest like that with our Father. After all, He knows our hearts anyway, so we may as well express them to Him.
Next, in his petition for relief, what the worshipper needs should be expressed with extreme simplicity. He should say with David, "Consider and hear me, O Lord my God; enlighten my eyes, lest I sleep the sleep of death!" In other words, "Oh Lord, give me understanding to overcome this problem - or I die!"
Then the song ends in a unique way - It closes with an expression of the worshipper's will to trust in God's mercy and to rejoice in His salvation. Even though he hasn't seen that salvation yet, still, knowing God, he's quite confident that he will receive it, so he deliberately and decisively tells God that He will trust Him for it, and he begins rejoicing as if he's already got it! He can do so because he's casting himself upon the Character and love of his covenant God.
So can we. Sometimes we just need to cease from our moaning long enough to shift our focus from our troubles to the faithfulness of our God.