When you first read these verses, one gets the impression that David is still contemplating the supernatural attributes of God. To understand, you have to read this Psalm in context not only of this Psalm but of the last one as well. Remember in the previous Psalm (Psalm 138), God told David that a son of his would rule forever. I don't know if this Psalm was written before or after the last one, but the point is David became aware not only that God exists, but that God desired great things for his life.
What an awesome point to consider that God is thinking about us and He has thoughts and plans for our lives. The phrase, "how great is the sum of them", denotes the superiority of God's knowledge in quality and quantity. The prophet Isaiah states a companion thought, "For My thoughts are not your thoughts, neither are your ways My ways, saith the LORD." (Isaiah 55:8).
So how could God's thoughts for us outnumber the grains of sand in the world? Even if He spoke to us daily, there is still a lot of sand out there. The underlying truth is not to literally count the times we have sensed His presence in our lives. The idea is to realize He is guiding every step of our lives and He has wonderful plans for our lives. I suspect those "grain of sand thoughts" continue into all of eternity for He will still be with us as we are His children forever.