1 Samuel 28:17
And the LORD hath done to him, as he spake by me: for the LORD hath rent the kingdom out of thine hand, and given it to thy neighbour, even to David: And the LORD hath done to him, as he spake by me: for the LORD hath rent the kingdom out of thine hand, and given it to thy neighbour, even to David:
The words belong to Saul's consultation of the woman of Endor, when he was fearful as the Philistine army faced Israel at Shunem and Gilboa. They announce that the Lord has carried out the judgment he had declared through Samuel, that the kingdom is rent out of Saul's hand and given to his neighbour, even to David. The battle with the Philistines is itself the fulfillment of that judgment against Saul.
The declaration is not delivered by Samuel himself or by the Lord, but by a counterfeit presenting himself as Samuel, and Saul's consultation of the medium is intercourse with Satan. The dead do not communicate with the living, but Satan's angels can impersonate the dead and speak as they would, and Satan knew Samuel well enough to represent him, using the appearance of departed friends to deceive and gain control of minds. God did not permit Satan to raise Samuel from the dead, to resurrect him, or to disturb his rest in the grave.
Although spoken through deception, the pronouncement correctly states Saul's fate and repeats the truth that the kingdom was taken from him and given to David. The voices of the Endor episode are lying words that mislead people. The message confronts Saul with the consequence of his rebellion, but it is presented in distorted form to magnify his guilt and despair and drive him toward ruin and self-destruction rather than repentance, and Satan exulted in his confusion.
Satan gave this true statement of Saul's end after leading Saul as a willing captive, winning control cautiously at first and leading him almost imperceptibly away from God until his perceptions were blunted, then making bolder suggestions until Saul could be led into crime and fully snared, and once Saul was fully in the snare exposing his doom before him. The inquiry of a familiar spirit is thus connected with his rejection and destruction and with the kingdom being turned over to David, and Satan used the prediction of doom through the woman of Endor to try to make rebellious Israel trust sorcery and be instructed by satanic cunning, turning from God as counselor and severing the last link holding them to God. Seeking knowledge of the future that God has withheld leads people to despise what he has revealed in his word.