“And Saul knew that it was Samuel.” Saul was deceived. What Saul saw was not Samuel, but a demon impersonating Samuel. It is well documented that ghosts and apparitions impersonate the dead, and that is the situation here.
There are many lines of evidence to support this understanding of what happened. One is that Saul went to a medium, and they deal with demon spirits, not with the righteous dead, which is why dealing with them is forbidden by God (cp. Lev. 19:31; Lev. 20:6, 27; Deut. 18:11) and why, when someone dealt with them, that act was listed with the person’s sins (cp. 2 Kings 21:6), and why righteous kings removed mediums from their kingdoms (2 Kings 23:24).
Also, God forbade people to communicate with the dead (Deut. 18:11). Samuel had been faithful to God throughout his life, so would he really disobey God now and appear to Saul to answer his questions? A demon would, but Samuel would not (and in any case, Samuel was not alive but dead in every way, so he could not personally appear to Saul. See Appendix 4, “The Dead are Dead”).
Also, Saul had tried to ask God about the things he wanted to know, and God did not answer him at all: “And when Saul inquired of Yahweh, Yahweh did not answer him; not by dreams, nor by Urim, nor by prophets” (1 Sam. 28:6). If God did not answer Saul by prophets when Saul asked living prophets, is God going to answer Saul by a dead prophet and break His own commands? No, He wouldn’t.
Many centuries ago the Church Father Tertullian realized that the “Samuel” who spoke to Saul was a demon, and he wrote: “God forbid, however, that we should suppose that the soul of any saint, much less of a prophet, can be dragged out of (its resting-place in Hades) by a demon. We know that “Satan himself is transformed into an angel of light” (2 Cor. 11:14)—much more into a man of light—and that at last he will “show himself to be even God” (2 Thess. 2:4), and will exhibit “great signs and wonders, insomuch that, if it were possible, he shall deceive the very elect” (Matt. 24:24). He hardly hesitated on the before-mentioned occasion to affirm himself to be a prophet of God, and especially to Saul, in whom he was then actually dwelling. You must not imagine that he who produced the phantom was one, and he who consulted it was another; but that it was one and the same spirit, both in the sorceress and in the apostate (king), which easily pretended an apparition of that which it has already prepared them to believe as real—(even the spirit) through whose evil influence Saul’s heart was fixed where his treasure was, and where certainly God was not. Therefore it came about, that he saw him through whose aid he believed that he was going to see, because he believed him through whose help he saw. But we are met with the objection, that in visions of the night dead persons are not unfrequently seen….” (Tertullian, “A Treatise on the Soul,” chapter 57. Ante-Nicene Fathers, Alexander Roberts and James Donaldson, ed., Hendrickson Publishers, Peabody, MA. Vol 3, p. 234, 1994.).
Tertullian is correct. Saul saw a demon. The demon in the medium at Endor did not have the power to raise the dead, but it, or other demons in the area, did have the power to impersonate the dead, which is what happened.
It has sometimes been objected that a demon could not have predicted the future the way that “Samuel” did when he appeared to Saul. But actually, demons have a lot of power and influence over future events, which is why people have gone to mediums and diviners for many thousands of years. If the mediums were mostly wrong, their profession would have died out long ago, but mediums and diviners are thriving today. Some events are hard to foresee, but Saul’s death was not. But because the Devil is the “god of this age” (2 Cor. 4:4) and has considerable sway on earth (1 John 5:19), and because Israel had sinned so badly they were not being protected by God, and because the Philistines had a larger, better-equipped army, it was not hard for the demon to predict that Saul and his sons, who would as a matter of custom be in the heat of the fight, would die in the battle the next day.
Also, however, we should note that prophets such as Samuel do not have the inherent power to predict the future. They rely on God to give them revelation about what is going to happen, and then they communicate that message to others. But God had refused to give his living prophets answers to the questions Saul had asked (1 Sam 28:6). So are we to believe that after refusing to answer Saul through living prophets, God now changed His mind and answered Saul through a dead one, in the process breaking His own command not to communicate with the dead? No, God would not have done that.
The record is clear. Saul asked God about the future in several different ways and God would not answer him. So Saul went to a medium who dealt with familiar spirits. Saul was deceived and sinning in what he did, and God did not give in to his desperation. However, a demon gladly fulfilled Saul’s desire and appeared as Samuel and gave a prediction that Saul would die, which came to pass.