Psalm 6 - This is a lament Psalm. David first speaks for himself giving full vent to His pain and emotions, then he addresses God, and last his enemies. As with most lament Psalms, this Psalm ends with a declared confidence in God resulting in hope.
Whether a prayer for recovery from a grave illness, suffering, or even trauma, David recognizes the all consuming nature of pain which has the ability to touch the physical, emotional, and spiritual aspects of our being. Yet, humans are not divided in their persons, instead we are whole, a soul who has physical, emotional, and spiritual needs. To suffer greatly in an one of these areas is to suffer in all (e.g. physical pain can lead to emotional or spiritual pain...).
We do not know if the Psalmist has made decisions which have led to the pain he is experiencing, but pain caused by physical sickness or being hurt by an enemy are both encompassed in this Psalm.
Also in view in this Psalm could be pain caused by one’s own sin. The wages of sin are always destruction, pain, and ultimately death.
A great example would be David’s decision to commit adultury and murder. These actions led to the death of an innocent child, fratricide, temporary loss of a kingdom, loss of wives, loss of friends, and loss of an adult son...all would have led to extreme physical, emotional, and spiritual traumas to David soul (the weight of the guilt of His sin would have been tremendous) yet even in this example (in the midst of God’s divine judgement of David) God’s mercy and lovingkindness are David’s only recourse.
In times of pain, all can wonder if we are being discipline for some sin (known or unknown). Perhaps greater than the understanding of “why” is the knowing of the “Who.” The question “why?” will ultimately not bring resolution to pain, but in the Who (God) we can take comfort in His mercy and loyal love.
Resolution for the Psalmist is found in the hope of God's lovingkindness (hesed) or loyal love (v. 4). The Psalmist acknowledges the possibility of death (v. 5) and seems to bargain with God - “if you let me live I will praise you, if I die how can I praise you?” [P.M. if you want to delve further into the ancient Hebrews view of the afterlife.
In conclusion the Psalmist finds comfort that God hears, accepts, and will respond righteously according to His character.
Here is the Psalm set to music thanks Michael Britton.