Lent is a season of renewal. A time when the light and heat of the cross brings us out of dormancy and spurs new life and new growth in us. 
David was moved out of his dormancy when the message of God brought his sin into the light, so he wrote Psalm 51 in response to this repentance and renewal.