How do spell/magic resistance and spell/magic immunity work?
Per the PHB (p. 197) rules on damage resistance:
If a creature or an object has resistance to a damage type, damage of that type is halved against it.
So perhaps spell resistance halves damage from spells. Does spell resistance confer protection against non-damaging effects? Does it help with saving throws against charms or web, for example? What about spell immunity?
Per the MM (p. 8) rules on vulnerabilities, resistances and immunities:
Some creatures have vulnerability, resistance, or immunity to certain types of damage… If a creature is immune to a game effect that isn’t considered damage or a condition, it has a special trait.
This is a bit sparse.
Aside from the PHB rules above on damage resistance, I can’t find any reference to immunities or resistances in the indices of the DMG, PHB, or MM.
EDIT: Following up on Oblivious Sage’s comment below: a number of entries in the MM aside from the Tarrasque have “magic resistance” as an ability, notably more powerful devils, demons, angels, etc. These are consistently of the “Advantage on saving throws versus spells and other magical effects.”