Psalm 23 is a well-quoted passage in times of sorrow and is very telling about God's relationship with us.
Verse 1 - David recognizes that Jehovah, the Lord, has a personal relationship with him as his shepherd. The Hebrew word for shepherd is raah which means to tend a flock and to rule, but also means that to associate with as a friend or to keep company with. As the good shepherd, the Lord leads his flock while providing for their basic needs, such as food, water, rest, refreshment and safety. The flock is all obedient believers. Matthew Henry's Concise Commentary states that "Discontent and distrust proceed from unbelief; an unsteady walk is the consequence." David realized his dependence on the Lord and had found contentment in Him.
Verse 2 - The green pastures and still water is more than just nourishment for the sheep; they provide comfort and a sense of security. We too can experience this comfort and security as well as renewal by following the guidance of the Lord. To rebel against God is to rebel against our own best interest.
Verse 3 - However, when we do stray, God can and will restore us when we repent. The path to restoration is to follow God who will never lead us in the wrong direction. The right paths that God will guide us along will bring us security and contentment.
Verse 4 - Walking with God does not mean there will not be hardships, but we have no need to fear with the Lord as our shepherd. "He who has his God for a companion need fear no danger." (Adam Clarke's Commentary) David found comfort in knowing that God would fight for him using His rod and would rescue him and put him back on the right path using His staff whenever necessary.
Verse 5 - In this verse David refers to the Lord as a Host which may seem like a drastic shift. However, in David's time, a host had the duty to keep his guests safe like a shepherd does for his flock. Also, a host anoint the guest's head with oil as a means of refreshment just as the Lord refreshes those believers that walk faithfully with Him. A host keeps his guest's cup full which was how David described the abudance of grace he receives from God.
Verse 6 - David expresses his confidence that God would continue to care for him and guide him. He was confident that in the future he would continue to benefit from God's mercy and goodness. Our future is also secure for the Lord is always with us as our Shepherd and our Host.