The Bible has a story about a case where communication with the dead actually happened. King Saul did it. The spiritist at En-Dor put him in touch with the prophet/judge Samuel, who had made Saul king many years earlier. This spiritist was apparently renown as an extra-large among the area's mediums. This was no fake Samuel she reached, either (despite what you may read in the fundamentalist press); the text treats him as the real Sam. But this Sam was not at all happy about being contacted. He truthfully issued God's final doom on Saul and his sons, specifically because Saul was so willing to do dirty to God. The next day, Saul found out first-hand about being in the realm of the dead.
(You can, of course, choose to take this incident figuratively. But there are no grounds for doing so here which you don't also have for most of the rest of Israelite history. You could also do something as radical as imposing modern-day theological conclusions about death upon the ancient Biblical text, and say, 'this is how it really went'. But that's a refusal to let the Bible speak for itself, a refusal on your part to really listen. The one option the text itself does not at all allow is that the apparition is a demon out to undo God's plans, for in fact, what's spoken is a great prophecy stating what God's plans are for a crucial moment in Hebrew history.)