David was human like the rest of us and he too was worn out at times from having to deal with his own problems. We see both his physical and spiritual exhaustion in verse 4. What was David's solution when he was too tired to go on? Did he just go get a good night's sleep? Verse 5 is the answer. David thought about how God has worked in the past and that gave him the mental energy to go on. Think of it this way, the reason the Bible and the Psalms spend so much time reviewing history is not for us to learn history, but to remind us that if God has worked to rescue people in the past, He can and does work to help us in our present distress.
It doesn't matter who you are, God loves you and He longs to help you. Do we always know how God will rescue us? Of course not. I just know the God I worship is perfect and therefore He knows all things. He cares for me and therefore, I can trust in Him to guide my life. Verse 5 is telling us that even when we are worn out from dealing with whatever we have to face, thinking about God's great works as told in the Bible reminds us that through His strength, we can face whatever it is we have to face in life and somehow God will lead us through those situations.
David proclaims in verse 6, I stretch forth my hands unto thee: my soul thirsteth after thee, as a thirsty land. Selah. I've always been a big believer that there is no official way of standing, sitting, kneeling or laying down in order to pray. God just wants us to talk to Him. The important thing is our attitude and sincerity when we come to Him. We come to Him desperate for Him to answer us because we need Him. This verse shows us a point of desperation in the Psalmists' life as he proclaims that his soul thirsts for God like a "thirsty (parched) land". He is desperate for God and trusting in God to answer his prayer request.
The word "Selah" is an untranslated word that simply means to think about what was just said. To consider David's desperate plea is in effect a "Selah".