Adonijah, the son of Haggith and an older brother of Solomon of a different mother (2:22), struggled in the way of usurping to be the successor to the throne of David (1:5-10). His attempt to usurp the throne was an act of rebellion.
In verses 11 through 31 we have an account of David's decisive declaration, in the midst of Adonijah's rebellion, to make Solomon his son the successor to his throne. Because of Solomon's origin, it was not easy for David to make such a declaration.
David's decisive declaration regarding Solomon was made by the help of the wise proposal of Nathan the prophet (vv. 11-14, 22-27). Whereas Joab joined Adonijah to rebel against David, Nathan strengthened him.
David's decisive declaration that Solomon should be the successor to his throne was made also through Bath-sheba's intimate entreating (vv. 15-21, 28-31).
Verses 32 through 40 speak of Solomon's accession to the throne of his father as the legal successor to the Davidic throne.
Solomon's accession was ordained by David his father (vv. 32-37). Regarding Solomon, David said, "Let Zadok the priest and Nathan the prophet anoint him there as king over Israel; and blow the trumpet and say, May King Solomon live!...He shall come and sit upon my throne, and he shall reign in my place; for I have appointed him as leader over Israel and over Judah" (vv. 34-35).
David's ordination concerning Solomon's succession was carried out by Zadok the priest, Nathan the prophet, and Benaiah the captain of the army (vv. 38-40).