It was the real Samuel. Did God send him? The witch summoned him. It is forbidden, because normally you talk to demons, but apparently it is also possible to talk to a saint, but contact with the dead is still forbidden.
Deuteronomy 18
“When you come into the land which the Lord your God is giving you, you shall not learn to follow the abominations of those nations. There shall not be found among you anyone who makes his son or his daughter pass through the fire, or one who practices witchcraft, or a soothsayer, or one who interprets omens, or a sorcerer, or one who conjures spells, or a medium, or a spiritist,
or one who calls up the dead. For all who do these things are an abomination to the Lord, and because of these abominations the Lord your God drives them out from before you.
Deuteronomy 18:9-12 NKJV
“When you come into the land which the LORD your God is giving you, you shall not learn to follow the abominations of those nations. There shall not be found among you anyone who makes his son or his
bible.com
If you don't call up the dead and see someone who just died say bye, nothing wrong with that.