Psalm 51 is perhaps the greatest prayer of repentance in the Bible and is useful for us to use when we need to seek God’s forgiveness and repent of our sins.
Psalm 51 is perhaps the greatest prayer of repentance in the Bible and it’s useful for us to use when we need to seek God’s forgiveness and repent of our sins, but what is repentance? What’s the difference between godly repentance and worldly sorrow? The word “repent” means more than changing your mind. It’s a change of the mind by the power of the Spirit of God. In the beginning, God created man…through Christ, God re-created man into a new creation (2 Cor 5:17), but repentance is something we can’t do on our own. The Bible teaches that God grants repentance and dead men can’t repent (Eph 2:1-2). The Apostle Paul told Timothy that “the Lord’s servant must not be quarrelsome but kind to everyone, able to teach, patiently enduring evil” (2 Tim 2:24). It was not Paul or others that opened Lydia’s heart to receive the gospel, but “The Lord opened her heart to pay attention to what was said by Paul” (Acts 16:14b; see Luke 24:45). God used Paul as a means to open her heart and when God opens a heart, that person will naturally repent of their sins. Without the Spirit of God, there will be no true repentance. Instead of having a godly sorrow over your sins, an unconverted heart will have worldly sorrow, and worldly sorrow only leads to death (2 Cor 7:10). Why? Because it’s not true repentance, and Jesus said, the gospel includes repentance and faith (Mark 1:15). 
Most scholars believe that it took about a full year for David to repent of his conspiracy to commit murder (Uriah) adultery with Uriah’s wife, Bathsheba, and that might not have happened without Nathan’s being sent by God to rebuke David for these sins. It was Nathan the Prophet that confronted David with his sin in those now-famous words, “You are the man! Thus says the LORD, the God of Israel, ‘I anointed you king over Israel, and I delivered you out of the hand of Saul” (1 Sam 12:7). This is why David cried out, “Have mercy on me, [O God, according to your steadfast love” (Psalm 51:1a), and “Wash me thoroughly from my iniquity, and cleanse me from my sin” (Psalm 51:2). God will do just that for any that comes to Him for a cleansing. His well of mercy and grace never runs dry.
Have you even done something and had that nagging feeling that you were wrong, or you said the wrong thing, or that you clearly sinned? I know I have…many times. So now what? Ask God for forgiveness and He will give it. Thank God for the conviction of the Holy Spirit. That’s why David said, “my transgressions, and my sin is ever before me” (Psalm 51:3). It was always on his mind; during the day time and when he went to bed. I wonder how many sleepless nights he had until he came to repentance.
God created man…then God recreated mankind through Christ. David knew it wasn’t in his nature to have a godly heart, so he cried out, “Create in me a clean heart, O God, and renew a right spirit within me” (Psalm 51:10). God will do the same for all who believe. He creates a new heart in us…a heart of flesh and not stone. He puts in us “a right sprit” or the Holy Spirit. He convicts us of wrong and prompts us to do good. The Spirit brings us to confess our sins and repent of them. In this manner, David cries out to God, “Restore to me the joy of your salvation, and uphold me with a willing spirit” (Psalm 51:12), so we see that David knows God can create in him, “a clean heart,” and that God can renew him by His Spirit. And God will also uphold him “with a willing spirit.” That’s how the joy of his (and our) salvation is restored. It’s not that his salvation is restored or that he lost his salvation and prayed to get it back. No. That was never missing. It was the “joy” of his salvation that was missing, and it was missing because he was living with unconfessed sin, and that robs the Christian of their joy. A Christian living in sin will have a very difficult and rocky road in this life because there will be consequences. There will be a reaping for everything sown; good for good and bad for bad. A joyless Christian seems contradictory. 
God is not so much interested in our making personal sacrifices (Psalm 51:16) as He is receiving the sacrifice of praise, brokenness, and humility. David said, “The sacrifices of God are a broken spirit; a broken and contrite heart, O God, you will not despise” (Psalm 51:17). God is pleased with those more than ten thousand rams or ten thousand dollars. The word used in this verse for “contrite” is very interesting. It’s better translated as “crushed,” like you would crush a grape or olive, and isn’t feeling crushed and broken what it feel like at times? Think about this; God cannot fix what is first not broken; so if we feel we’re “good to go,” we’re more broken than we realize. Our hearts can so easily deceive us.
If you are in Christ, you will be spared the wrath of God. That’s why today I pray that you put your trust in the Savior. Today is the best day to do that (2 Cor 6:2) because after death or at Christ’s appearance, times up! If you wait too long, you might die in your sins, and that means you’ll be without hope…forever (Rev 20:12-15). That makes right now the very best time to put your trust in the Savior.
Here is some related reading for you: What Does the Bible Say About Repentance? 
Resource – Scripture quotations are from The Holy Bible, English Standard Version® (ESV®), Crossway Bibles. (2007). ESV: Study Bible: English standard version. Wheaton, Ill: Crossway Bibles. Used by permission. All rights reserved.