At the beginning of Second Samuel, David returns to Israel and is anointed king by a large contingent of supporters, but he is not universally accepted. There is still a group of soldiers loyal to Avner, the de facto retainer of Saul's line. It is very clear by Chapter 3 that Avner has opportunistically claimed all that Saul once had, if only because there is no one but David to oppose him. Avner even takes Saul's concubine for himself, a sign that he has been using the civil war in Judah to luxuriate in the ill-gotten trappings of royalty. The entire third chapter of Second Samuel is about setting things right, including relieving Avner of the throne he stole.
The war between David and Avner is a foregone conclusion. Avner's forces grow weaker with each passing battle. Even if Avner's army didn't just come off a disastrous campaign against the Philistines, David is well known as the greatest living military commander of the region. Up to this point in the story, he's never lost a battle. With the war all but lost and Ish-boshet, Saul's one surviving son, starting to question the motives of Avner as his protector, Avner sends emissaries asking for a meeting with David.
Once again, David may pursue his war against a Judean enemy, but there are significant narrative problems with him actually landing the killing blow. During their meeting, Avner asks David for a truce and a sort of power-sharing plan. David agrees to this, though it's not clear why. Perhaps it's out of mercy or perhaps it's a more calculated bid to capture public support from Avner's contingent.
Whatever the case, Avner never sees home again. David is still friendly with the Philistine leaders who took him in during the last days of Saul, but they don't share his optimism about Avner. While Avner is on his way back from the meeting, the Philistines intercept him and kill him, ostensibly in revenge for the death of another royal during the last war.
Though the death of Avner means the end of the civil war, David doesn't celebrate. Instead, he holds a grand funeral for his enemy and laments the needless violence of his time. He has recently reunited with his first wife, Saul's second daughter Michal. She has since taken another husband, though he can't be her rightful partner. In this scene, too, there is heartache. Michal's second husband isn't depicted as a cur or even a supporter of Avner. He's merely a simple man who tried to do right in a confusing age.
These early chapters of Second Samuel are brutal and consistently tragic. They depict an era in which nothing is as it should be. Kingdoms are in the hands of the wrong rulers, people are attached to romantic partners that are meant for someone else, and any sense of justice is circumvented by lawless chaos. The lesson in these disturbing passages is that disorder creates havoc in the lives of all people, good and bad. It's not that nobody in this story knows what's right, it's that they consistently choose to go against propriety for their own ends.