Adoniyahu, son of David and Chagit, decided that he was the logical successor. (He was the fourth-born son; his older brothers Amnon and Avshalom were dead and Kilav didn't want the job.) He took a page from big brother Avshalom's book and got chariots and runners to go before him. Unlike Avshalom, he did not intend to depose David, he just meant to position himself for when his father passed on. Yoav and Evyasar signed on to Adoniyahu's team and encouraged the people to support his cause. But Tzadok, Benayahu, Nathan the prophet and others did not support Adoniyahu. Adoniyahu made a feast and did not invite David's supporters or his half-brother, Solomon. At this point in most people's minds, it was all but a done deal that Adoniyahu was going to be king.
Nathan approached David's wife Batsheva, mother of Solomon. G-d had said that Solomon would be king after David and David had promised this. Batsheva was to go to David and inform him as to Adoniyahu's actions, then Nathan would enter and back her up.
Batsheva went to David and told him that Adoniyahu was calling himself the next king. While she was still speaking, Nathan entered and asked David if he ordered Adoniyahu to be the next king. After all, he was having a party with most of David's other sons and counselors, who were all screaming out, "Long live King Adoniyahu!"
That was enough for David. He commanded that Tzadok, Nathan and Benayahu take Solomon and anoint him king, them publicly proclaim it. Solomon was then to sit on David's throne, so everyone would know he was the designated successor. This they did, and the people went wild with celebration.