This song reminds the worshipper of the two kinds of people in the world: those who love the Lord and those who don't, those who want to hear His Word and those who don't. In this song, then, the worship leader, standing in the temple on Mount Zion, leads the people, early in the morning, to sing out an exhortation for those who want to live as those who love God.
He sings out that those who do love the Lord and desire to please Him should want nothing to do with the ideas of those who don't - they shouldn't want to be influenced by them in any way. They don't walk with them, stand with them, or sit with them in conversation. In other words, they simply don't travel in that crowd, because they don't want to begin acting as they do. The song reminds them that the Lord "blesses" them in this - that He approves their behavior, that they've actually begun to please Him in that way.
Having sung about what they shouldn't do, the leader then turns to the positives. He says, "But his delight is in the law of the Lord (the entire Bible), and in His law he meditates day and night." In singing these words the leader paints a picture of those who love God: they are ones who gladly hear His Word, and they are always considering what it means for them - they meditate on it day and night. That means that even when they daydream, it's about how the Word might apply to what they do each day.
The people are next led to sing about the blessing of the Lord upon those who meditate in that way. He says, "He shall be like a tree planted by the rivers of water, that brings forth its fruit in its season, whose leaf also shall not wither; and whatever he does shall prosper." What encouragement! He leads them to see in other words, that they'll be very successful - just as a tree, planted by refreshing, strengthening water grows, blossoms, and is fruitful, so the lover of God succeeds in life (not necessarily as the world understands "success," but in God's view of things). Those who make it a habit to consider how they may please their Lord will abundantly succeed in doing so!
But that's not the way it is with the ungodly, with those who don't really care to consider how to please the Lord. They may at times think they're prospering in life, and they may think that getting ahead financially and socially is "where it's at," but in the sight of the Lord and in view of the reality of His eternity they are total losers. They'll have to stand before the Almighty and holy God to answer for their attitude and behavior, but they won't be present when God gathers the "congregation of the righteous" to Himself.
Finally, the people are led to sing the real clincher: "For the Lord knows the way of the righteous, but the way of the ungodly shall perish." That's exactly what the godly need to know. They (we all) need to be aware that God CARES, that He's not out there somewhere, paying no attention when we're trying to please Him, but that He sees it ALL!