After David won the trust of the Philistine king, Achish, by happily performing random acts of genocide on the surrounding people, Achish said it was time for him to start killing Israelites. David could hardly wait.
The Philistines gathered their armies together for warfare, to fight with Israel. And Achish said unto David, Know thou assuredly, that thou shalt go out with me to battle, thou and thy men. And David said to Achish, Surely thou shalt know what thy servant can do. 1 Samuel 28:1-2
When Saul saw that the Philistines (along with David) were preparing to attack, he was afraid. He asked God what to do, but God ignored him.
And when Saul enquired of the LORD, the LORD answered him not, neither by dreams, nor by Urim, nor by prophets. 1 Samuel 28:6
Since God wouldn't talk to him and Samuel was dead, Saul asked a witch to bring Samuel back from the dead to deliver a message from God.
And God went along with the whole witch-seance-necromancy thing. He repeated the same old stuff about how he took away Saul's kingdom and gave it to David because Saul didn't kill all the Amalekites like he told him to.
The LORD hath rent the kingdom out of thine hand, and given it to thy neighbour, even to David: Because thou obeyedst not the voice of the LORD, nor executedst his fierce wrath upon Amalek, therefore hath the LORD done this thing unto thee this day. 1 Samuel 28:17-18
God also said that he had other punishments planned for Saul. Tomorrow he was going to have the Philistines defeat the Israelites and kill him and his sons.
Moreover the LORD will also deliver Israel with thee into the hand of the Philistines: and to morrow shalt thou and thy sons be with me: the LORD also shall deliver the host of Israel into the hand of the Philistines. 1 Samuel 28:19
So God spoke to Saul through a dead man brought back to life by a witch. And the message was this: I'll have the Philistines kill you and your sons tomorrow because you left one Amalekite alive when I told you to kill them all.
Kind of makes you feel warm all over, doesn't it?