This chapter is a copy of the original records in 2 Samuel 5:11-25.
According to 2 Samuel, the events in chapter 14 (2 Sam 5) happened before the events in chapter 13 (2 Sam 6).
David Had Many Wives in Jerusalem
v2: [David knew that the LORD…] David understand he did not become King of the whole Israel by his own ability, but was established by God.
v3: [In Jerusalem David took more wives…] Deut 17:17 forbids King to take many wives. Although God did not prevent David from having many wives, it does not mean God approved polygamy. David had to face serious consequences as a result of his action, see 2 Sam 13.
God Helped David to Defeat the Philistines
v8: [they went up in full force to search for him…]. Once the Philistines found out David had been anointed as the king over all Israel, they wanted to kill David because David is now a treat to the Philistines.
v10: [..David inquired of God..] and v14 […David inquired of God again…]. These records show that David is a man after God’s heart. He depended on God for power and desired to do the will of God. As a result, God has gone out before him (v15) to strike the Philistine.
If we desire to defeat the enemy, if we desire God to go out before us in our spiritual battle, we need to learn to come before God to seek His will and ask for His wisdom and power.