Having been a shepherd, David was very, very familiar with shepherding. For that reason he naturally likened his relationship with God to the sheep's relationship to their shepherd. It was a close, caring relationship that he knew very well, and it truly satisfied his heart to think of Jehovah as his Shepherd. He wanted all the people of his kingdom to share in that satisfaction, that happiness of relationship.
In the early morning, therefore, he went to the tabernacle to meet those who were gathered there to worship Jehovah. He went as their worship leader, their cantor, and when he led them in the first line of the morning psalm the words reflected his own relationship to his loving God. He sang,"The Lord is my shepherd." Every worshiper repeated the words, thereby establishing in their hearts that God was their Shepherd also.
And what a loving, caring Shepherd their God was! David got the people to sing about it by having them repeat, "I shall not lack. He makes me to lie down in green pastures, He leads me beside the still waters. He restores my soul; He leads me in the paths of righteousness for His Name's sake." So the people also all found themselves confessing that God does all these things for them as well! It's beautiful praise to a loving, caring God!
Then, having experienced dark and desperate times as well as good times in his walk with God, and knowing that such times are a part of the lives of every one of us, David leads all the people to confess their Shepherd's loving care in those times as well. He sings, "Yes, though I walk through the valley of the shadow of death, I will fear no evil, for You are with me; Your rod and Your staff, they comfort me!"
David knows that his God is a loving Shepherd in ALL the situations of life, whether in the presence of deadly enemies or loving friends. He knows that he'll ALWAYS be safe in his Shepherd's care. It's no wonder that he sings about it! And the people, with a new and blessed realization of the goodness of their God, gladly sing it after him. They joyfully sing out the fact that their situation (their "cup") is overflowing with the Shepherd's goodness ALL the time!
Then comes the final chorus, the final confession of God's loving kindness. They sing, "surely goodness and mercy shall follow me all the days of my life, and I will dwell in the house of the Lord forever!"
Can we apply all of this to ourselves? We could begin by praying to see His loving, shepherding hand at all times, and in every situation of life. Sometimes we're so blind! But by His Spirit He'll help us if we ask it. Then let's pray that we will be as sheep are to their shepherd, following Him, trusting him and loving Him all the time! And let's give Him thanks for both rod and staff in every situation - even when, like sheep, we don't fully understand!