In this portion of the Psalm, David brings up a principle we need to consider.
At first glance, we might conclude that God does wonderful things in David’s life because David does his best to honor God. In other words, David follows God’s laws (and does his best to live righteously) and God is obligated to reward him.
This manner of thinking is deeply embedded in our minds. IF we do good, God has to do good by us. So, in a very real sense, we feel that we can control God (and His favor) by doing a bunch of good or religious things.
This is a deeply religious mindset – and crosses over into witchcraft (our actions control God). MY good actions, MY righteousness, MY devotion, MY sacrifices MERIT the actions, righteousness, devotion and attention of God. This mindset reduces God to “the genie in the bottle” that we keep handy… and use to grant all our wishes.
But this is not really what David is talking about. Sure, he mentions his own righteous actions and he credits God with responding to his righteous actions – but he goes on to give us the proper framework for his observations.
The key is found in verses 25-26. Here, David tells us that it is God’s nature (and God’s choice) to respond in like manner to how we treat Him. If we honor Him, God chooses to honor us (and bless us immensely).
But if we choose to dishonor Him, He will choose to dishonor us. If we ignore Him, He will give us every impression that He is ignoring us. If we choose a path of wickedness, God will appear “torturous” to the wicked. If we chase after other pleasures, other pursuits, other gods – He will not chase after us… but will “give us over” to those pleasures, pursuits, and gods (see Romans 1:18-32!).
In common language, He gives us enough rope to hang ourselves (even though the “hung” will surely find fault with His methods).
David is not telling us about an incantation or magic formula for controlling God or gaining God’s favor. He is simply giving us what God has established from the beginning of His interactions with us… the cause and effect of how we choose to treat Him.
We do not control God by either our good or bad behavior – but we decide the path of our own lives by how we treat the One Who made us and Who seeks to fill our lives with His powerful love.