(Go to this verse :: Verse pop-up)
The Hebrew word translated "pray" in verse 17 is rib, indicating a feeling, an emotion. It can be used in a sense as soft as "to complain." David was complaining in this prayer. However, it can also mean "to grapple with, rumble, fight an adversary, strive, or contend as with a judge."
This suggests the context of the prayer. David was overwrought emotionally, angry, in this prayer. He was in despair because one that he considered to be a good friend had stabbed him in the back. He and his trust had been betrayed, causing deep hurt and anger. We, too, may have gone to God deeply hurt and angry, with an intensity in our words that was not there at other times.
The point is that prayer is used in all occasions. It is not always to be formulaic and formal, a rote prayer to God like, "Now I lay me down to sleep" or "Our Father which art in heaven." God intends that our speech with Him arise from the very depths of our present situation and that our prayers' emotional content will vary from time to time. Sometimes we will be downright angry and upset. As we can see from David's example, we do not have to worry about being angry or upset before Him.
John W. Ritenbaugh
What Is Prayer?