2 Samuel 16 describes how Ahithophel is giving Absalom bad advice. David had refreshed himself and he was now thinking right and keeping his eyes up and looking to the Lord. The Lord was the one who was frustrating the good advice of Ahithophel in order to bring disaster on Absalom. As Christians we need to be able to discern what is godly advice and what is worldly advice. God is sovereign and the word of God helps us see clearly.