Suppose a cleric casts Zone of Truth on a captured enemy. Unbeknownst to them, the enemy is a rakshasa. Zone of Truth says (PHB, p. 289):
You know whether each creature succeeds or fails on its saving throw.
But (MM, p. 257):
The rakshasa is immune to spells of 6th level or lower unless it wishes to be affected.
Assuming the rakshasa doesn't wish to be affected by the Zone of Truth spell, does the caster know this?
More generally, does a caster know when targets are unaffected by a spell they have cast, either because they have made saving throws, or because they are outright immune to the spell or its effects (e.g., casting Ray of Sickness on a shadow demon, which is immune to poison damage and the poisoned condition)?