Say what you want about David and his errors. The man had a right understanding of our proper posture before the Lord!
Why was David so successful in life? Why was he rescued time and again from the hands of his enemies? Why did God look with such favor upon him? I don't know that I have a complete answer, but certainly David's recognition that he had nothing to offer God and could only adopt the attitude of a humble penitent must have been a step in the right direction.
David confesses his helplessness throughout Psalm 143, like he does in many others. He acknowledges that he cannot appear before the Lord and plead his case as someone righteous. "Do not enter into judgment with your servant, for no one living is righteous before you" (vs. 2). Instead David is counting on God answering him because of His righteousness and faithfulness (vs. 1).
Like a helpless infant, David reaches out to God to be his source of strength. "I stretch out my hands to you; my soul thirsts for you like a parched land" (vs. 6). Without the Lord's help, David is doomed to death: "Do not hide your face from me, or I shall be like those who go down to the Pit" (vs. 7).
If David has anything to offer the Lord, it is his future self, one that can be strengthened and sanctified through God's influence. Twice David urges the Lord to "teach" him in the way he should go and how to do God's will (vs. 8 and 10). All that David can give the Lord is himself: "for I am your servant" (vs. 12).
While it is probably not a good idea to imitate David in all of his ways, he does provide a great model for the Christian saint who recognizes his own helplessness before the Lord.