Second Samuel 17:2419:8a describes how Absalom was defeated and killed.
In 17:24-26 we see that Absalom pursued after David, camping in the land of Gilead.
Barzillai the Gileadite and others came to support David and the people who were with him (vv. 27-29).
David organized his army and sent them to fight against Absalom and his people (18:1-5). When David told the people that he would surely go forth with them, they said that he would not go forth, for he was worth ten thousand of them. The king agreed, saying, "What seems best in your sight I will do" (v. 4a). Then David commanded Joab, Abishai, and Ittai, saying, "Deal gently for my sake with the young man Absalom" (v. 5a).
According to verses 6 through 8, Absalom and his people were defeated by the servants of David in a forest.