This event occurs in the First Book of Samuel. it is also mentioned in the deuterocanonical Book of Sirach.
The Witch of Endor is a woman who, according to the Hebrew Bible, was consulted by king Saul to summon the spirit of the prophet Samuel. Saul wished to receive advice on defeating the Philistines in battle, after prior attempts to consult God through sacred lots and other means had failed. When summoned, however, the spirit of Samuel only delivers a prophecy of doom against Saul.