What this book is about
David becomes king and unites Israel, and God promises that his family will rule forever. Then David falls hard: adultery with Bathsheba and the murder of her husband. The rest of the book is the fallout in his own family.
David is called a man after God's own heart, and he also did terrible things. His honest repentance shows what to do after you've blown it.
Your note on 2 Samuel