Because Saul didn’t completely perform God’s commandment (to commit complete genocide on the Amalekites), God repented of making Saul king and gave his kingdom to David.
But that wasn’t the only punishment God had in mind. Now God just needed to find a way to tell Saul about it.
He did it through a dead man (Samuel) who was brought back to life by a witch.
Samuel’s ghost told Saul that tomorrow God would kill Saul and his sons by delivering the Israelite army into the hands of the Philistines.
Because thou obeyedst not the voice of the LORD, nor executedst his fierce wrath upon Amalek, therefore … 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 [i.e., you and your sons will be dead]: the LORD also shall deliver the host of Israel into the hand of the Philistines. 1 Samuel 28.18-19Well, I don't know if it was the next day or not but the Philistines attacked and the Israelites "fell down slain in mount Gilboa."
Now the Philistines fought against Israel: and the men of Israel fled from before the Philistines, and fell down slain in mount Gilboa. 1 Samuel 31.1So that left Saul and his sons. God took care of Saul's sons by having the Philistines kill them. (I know it sounds cruel, but they deserved it since their father saved one Amalekite alive and God told him to kill them all.)
The Philistines followed hard upon Saul and upon his sons; and the Philistines slew Jonathan, and Abinadab, and Melchishua, Saul's sons. 1 Samuel 31.2Saul must have been especially hard for God to kill, though, because he had to do it four different ways.
Saul committed suicide.
Therefore Saul took a sword, and fell upon it. So Saul died. 1 Samuel 31.4
Then said Saul to his armourbearer, Draw thy sword, and thrust me through therewith; lest these uncircumcised come and abuse me. But his armourbearer would not; for he was sore afraid. So Saul took a sword, and fell upon it. 1 Chronicles 10.4An Amalekite killed him.
And he [Saul] said unto me, Who art thou? And I answered him, I am an Amalekite. He said unto me again, Stand, I pray thee, upon me, and slay me. So I stood upon him, and slew him. 2 Samuel 1.8-10The Philistines killed him.
The Philistines had slain Saul. 2 Samuel 21.12God killed him.
So Saul died for his transgression which he committed against the LORD, even against the word of the LORD, which he kept not, and also for asking counsel of one that had a familiar spirit, to enquire of it; And enquired not of the LORD: therefore he slew him, and turned the kingdom unto David the son of Jesse. 1 Chronicles 10.13-14But one way or another, God got the job done, and Saul, his three sons, and who knows how many Israelite soldiers all died -- because God was pissed off at Saul for the incomplete genocide of the Amalekites. Or was it for not inquiring of the Lord? I guess it really doesn't matter, does it? God can kill anyone for any reason, or for no reason at all, and every believer will be OK with it.
(Saul and his three sons were killed along with the Israelite soldiers. Since the Bible doesn’t say anything about how many soldiers were killed, I guessed 100.)