In this chapter, David shares his final words, and we learn more about the exploits of David's most valiant men.
David is following in the grand tradition of other OT figures by giving us a magnificent set of "last words", a final prophetic pronouncement about something or other. Jacob gave us his pronouncement about the future of his twelve children in Genesis 49, and Moses give us both a song and a "final blessing" in Deuteronomy 32-33.
For whatever reason, the prophecies of Jacob and Moses are mostly focused on the future of the twelve tribes. David, however, appears to be mostly talking about himself. Still though, despite the differences in content, I think it's pretty clear that this chapter is meant to evoke the same kind of imagery as Gen 49 and Deut 33, namely, the grand old patriarch passing down to us his final words of wisdom. I don't think it's a coincidence that the previous chapter (2 Samuel 22) is a song, and this chapter is David's last words, which parallels the structure of Moses's final song and prophecy from Deuteronomy.
At an even higher level, these two figures represent two distinct eras. Moses shepherded Israel through one of their first great eras when he brought them into the covenant with God at Sinai and then into the promised land. David is bringing Israel into their next great periods which is marked by glory and power. David defeated all of Israel's enemies, expanding them into a regional power, and establishing the most significant royal dynasty in Israel's history. Although Saul was their first king, it is David who will be remembered as their most beloved king. In a sense, we can imagine Moses as representing the Pentateuch, and David as representing the kingdom period.
In terms of content, David seems to be mostly talking about himself. In verse 1 he calls himself the "sweet psalmist of Israel", referring to his musical career to which we have been only briefly acquainted (he sang once at the death of Saul, and again in the previous chapter). We knew he played the harp for Saul in his youth, but he is also likely the author of a large number of songs, which are contained later in the OT.
In verses 3-4 David talks about the blessing of a righteous king, making a thinly veiled reference to himself. In verse 5 he refers even more directly to God's promises to him from 2 Samuel 7.
And that's pretty much it as far as I can tell. David is just kinda bragging about how awesome his kingdom is and that God is going to secure his future with an everlasting covenant.
In the second, and somewhat longer, half of this chapter, we learn the names and exploits of some of David's "mighty men". I see this as a longer version of what we read in 2 Samuel 21, when we learned about the four of David's men who slew giants during various wars. In this chapter we have David's men doing all kinds of crazy things, most notably killing hundreds of enemy soldiers while fighting alone, which is similar to what Jonathan did when he attacked a Philistine outpost and killed a bunch of dudes (1 Samuel 14). As with 2 Samuel 21, I think the main point of this story is to show us how David inspired others to greatness.
For the most part I don't have anything to add to the stories in this chapter, so instead I'll make a few comments on the names.
1) The "Three" are heroes of David who are only named here and whatever role they might have played in David's stories was entirely anonymous. Many of the "Thirty", David's B-list soldiers, are also unknown outside of this chapter. So I think it's interesting that these heroes are running around killing hundreds of enemies by themselves and yet they are given very little attention in the stories of Samuel. Of course, it makes sense that Samuel would focus more on the kingship and redemptive history of Israel than just some dude hacking down Philistines, but I think it's interesting that these guys can go around being all amazing, and yet to us they are largely unknown. What I think about this is that they were successful, they achieved great things, even though they are not known to us. In the same way, we are capable of achieving greatness even in the midst of obscurity.
2) Abishai was amongst the Thirty. This isn't too surprising because from previous parts of the story it was clear that Abishai was a pretty heroic guy. He has a lot of amazing exploits, though he was also quite violent compared to David, asking permission on many occasions to kill David's enemies. He also closely supported Joab in spite of Joab's several crimes. Abishai supported Joab because they were brothers, and in their culture blood relations were frequently more important than right and wrong (for instance, Judges 19 when the tribe of Benjamin fought against the other tribes to protect their own tribesmen). What I learn from Abishai is this: being amongst the Thirty or the Three does not mean they are perfect, it means they are brave. I do not think Abishai was perfect, but he was brave and he fought valiantly in many wars.
3) Benaiah the son of Jehoiada was "over the Kerethites and Pelethites" in a couple previous verses. Here we are told that he was placed over David's personal guard (v. 23), which is probably what the Kerethites and Pelethites refer to.
4) Asahel was one of the thirty, but he was killed years ago in the fight against Abner and Ish-Bosheth.
5) Elhanan the son of Dodo of Bethlehem is possibly the same Elhanan that killed Goliath in 2 Samuel 21 even though the names are slightly different and Rashi asserted that the Elhanan in 2 Samuel 21 is another name for David. I think it's more likely that Elhanan in that chapter and this one is the same person, and a different person from David. In that case, Elhanan killed another giant from Gath, possibly named Goliath. It's also possible that the author is conflating elements from David's story with the feats of another man, Elhanan.
6) Eliam the son of Ahithophel is a new character to us, but Ahithophel himself is not. He was David's close counselor in the time of Absalom's rebellion, and Ahithophel sided with Absalom. He killed himself during that revolt. We aren't told what happened to Eliam himself, since at least one of the Thirty (Asahel) died years ago, it's possible Eliam died during the revolt also. Or it's possible he sided with David and survived.
7) Zelek the Ammonite and Uriah the Hittite are both from the nations of the promised land that Israel was commanded to destroy. It is likely that they converted to Judaism and at least in the case of Uriah, we know that he served faithfully in the army and was (by all accounts) a pretty amazing guy. David had him killed off in 2 Samuel 11 to cover up his affair with Bathsheba.
So out of the ~35 people mentioned by name, we have heard of about 4 of them before, and even those 4 we barely know.
Lastly, the final verse of this chapter states that there were 37 in all, which is obviously not "30" plus "3", so there are a few more people included in that count. I tried counting the names myself and if you count the "armor bearers" and the "sons of Jashen" as one person each, then the total number of names (including Abishai and Benaiah) is 37, assuming I've done my math correctly.
My best guess is that "the Thirty" and "the Three" are not meant to be literal numbers, but rather designate groups of individuals with a certain level of reputation or authority and I'd be willing to bet the exact number varied over time as heroes came and went. It's not really a number as much as a position.