David is confident that God is going to answer his prayer. It seems that this assurance is the result of providing God with reasons for why he should answer. David doesn't merely ask for what he wants. He explains to God precisely why he should grant his request.