What do you do if you switch sides: from advising the king of Israel to helping his son in a rebellion? You give your best advice, and that’s what Ahithophel did:
2 Samuel 17:1-3 Now Ahithophel urged Absalom, “Let me choose 12,000 men to start out after David tonight. I will catch up with him while he is weary and discouraged. He and his troops will panic, and everyone will run away. Then I will kill only the king, and I will bring all the people back to you as a bride returns to her husband. After all, it is only one man’s life that you seek. Then you will be at peace with all the people.”
It was a good plan, but it was foiled by advice from Hushai. Loyal to David, he firstly countered this strategy with a ‘wait until morning’ approach. Secondly, he sent a warning to David to cross the Jordan River and get away, just in case Absalom changed his mind, again, and followed Ahithophel’s advice.
So David escaped. Ahithophel realised his plan hadn’t gone ahead. Could Absalom win now? Ahithophel must have believed it wasn’t possible. This left him suporting a losing side, in which case he would be executed when David returned.
So Ahithophel saw only one course of action:
2 Samuel 17:23 When Ahithophel realized that his advice had not been followed, he saddled his donkey, went to his hometown, set his affairs in order, and hanged himself. He died there and was buried in the family tomb.
He could have tried to flee to another country, but there might have been nowhere to go as most were now vassals: Israel had conquered all the surrounding countries. Suicide was all he could see.