Just because people are "royalty” doesn’t mean everything goes well in their lives. Look at the past (and current!) in Great Britain today! While David was a king, he was just a man. He had normal problems like everyone. He had struggles with his job, struggles with his family, and struggles with other people seeking to build themselves up and tear him down.
Psalm 30 gives us a unique look at the mindset of David. He begins with praise to God. Most people feel he is thinking of a near death experience. Perhaps it’s due to health or an attempt on his life by an enemy of sorts. Nevertheless, he is remembering a very difficult circumstance. And his response is thanksgiving. Look at the phrases “drawn me up,” “cried to you for help,” “you have healed me,” “brought up my soul,” “restored me to life.” These all invoke an aspect of thanksgiving and praise. That is why he begins with praise to the Lord in v. 1 - “I will extol you, O Lord.” Despite the problems, there is praise.
Let us be like David today. As long as we have breath, we will have problems. But he looked to the Lord for his help and deliverance and in the end realized it wasn’t about him, but it was all about the Lord. He praised the Lord in a near death experience. How much more should we praise the Lord today.