This little psalm is very full of beauty as it traces the way by which many a tried and , tempest-tossed soul has found consolation and strength. First of all, there is the cry almost of despair. Foes are oppressing the men of faith. There seems to be no succor even from the LORD. Yet carefully note that his faith in the LORD, He is able to help. To God then he cries.
"my heart shall rejoice in thy salvation." That backward look has served to remind the troubled heart of deliverances and a new confidence is born of the memory which utters itself in a song. It is good to remember all the way the LORD has led us when the day was dark with fear.
To the chief Musician, A Psalm of David. How long wilt thou forget me, O LORD? for ever? how long wilt thou hide thy face from me?
Psalms 13:2
How long shall I take counsel in my soul, having sorrow in my heart daily? how long shall mine enemy be exalted over me?        Spurgeon    
Psalms 13:3
Consider and hear me, O LORD my God: lighten mine eyes, lest I sleep the sleep of death;
Psalms 13:4
Lest mine enemy say, I have prevailed against him; and those that trouble me rejoice when I am moved.
Psalms 13:5
But I have trusted in thy mercy; my heart shall rejoice in thy salvation.