I just read this answer to Can you Plane Shift to the plane that you're on? and it made me wonder: As a spellcaster, how do I know why spell failed? Is there any roll for it in either Pathfinder or D&D 3.5? Any rule?
For a high-level spellcaster who knows his craft to be unable to identify the cause of failure seems weird, at least, so is this really so?
Spells that can fail without apparent reason:
Resurrection and Animate Dead cast on a body that is actually an immobilized undead
Plane Shift, as already mentioned
Any spell cast in an antimagic or dead magic zone when the character does not know of it
Necromancy cast on a disguised construct (not impossible with Warforged around)
Animal Trance when the target is actually an aberration
Control Water when the liquid is not actually water
Know Direction in chaos planes with no North
Scrying a creature that doesn't exist
Spells forbidden by a Mythal or similar powerful magic
Spells that got Counterspelled
All spells if Goddess of Magic dislikes you and decides to cut your access (as far as I remember Mystra had this option in Forgotten Realms)
And probably many more — I'm looking for general answer. Hints on specific cases would be nice, but I ask as a player, not DM, so I can't hope to always know which specific case it is in the first place.
For example, if Animate Dead fails, it might be due to the target not being a dead body, a Mythal effect, an NPC with silent means of necromancy counterspelling, or divine interference. (All those have happened to me or mine before.) And while there are means to get to know why and what a goddess thinks, a clue that the failure is her doing would save a lot of unneeded work (and gameplay time).