A Shield spell is cast as a reaction to an attack that hits. It applies its AC bonus against even the attack to which it is a reaction, meaning that it can make that attack that hit, retroactively miss and thereby not do damage.
Shield 'interrupts'/potentially cancels its trigger, as stated in the DMG in the 'Adjudicating Reaction Timing' section.
Since the damage has retroactively not been done, what happens to effects that were triggered by the damage in the first place? Are they undone as well, or do they persist?
This question has two answers of nearly equal popularity, with one arguing that other effects triggered by the hit still persist, and the other arguing that they do not. On the side of the argument that they do not occur is a (now-unofficial) tweet from Jeremy Crawford stating
If the attack has a special effect that relies on it hitting, that effect doesn't occur if the attack is turned into a miss.
If we accept that Shield means the effects of a hit retroactively do not happen, what occurs when those effects include ones that allowed the Shield spell to be cast in the first place?
I am currently running Curse of Strahd and in today's session the party was fighting flameskulls, which are undead capable of casting the Shield spell.
The party cleric had turned multiple flameskulls.
"Channel Divinity: Turn Undead":
A turned creature must spend its turns trying to move as far away from you as it can, and it can't willingly move to a space within 30 feet of you. It also can't take Reactions.
At the start of the paladin's turn, the flameskull could not cast Shield, since it was Turned, and could thus not use its reaction. It is interesting (and more complicating) that a Turned creature still has a reaction, but cannot use it, as opposed to other effects which simply do not allow the affected creature to have a reaction.
The party paladin then attacked a flameskull that had been turned, and hit, causing damage.
This damage removed the turning effect on the flameskull, allowing it to cast spells.
"Channel Divinity: Turn Undead"
it is turned for 1 minute or until it takes any damage.
Once the flameskull had taken damage, it was no longer Turned. Since it was no longer Turned, it was able to use its reaction, and thus able to cast Shield.
As a reaction, the flameskull cast Shield, which resulted in the effect that it was retroactively not hit.
Since it had not been hit, it had not taken damage. What happens next?
Option A: Although the damage as a consequence of the hit is removed, the fact that the damage was done at one point in time was enough to remove the Turned effect. The spell slot for Shield is removed, the flameskull is undamaged but no longer turned, and the paladin finishes his turn.
Option B: Since the damage as a consequence of the hit is removed, the flameskull is retroactively still turned. The spell slot for Shield is removed, but the flameskull is still Turned, and the paladin finishes his turn.
Option C: Since the damage as a consequence of the hit is removed, the flameskull is retroactively still Turned. The spell slot for Shield is removed. Since the flameskull is retroactively still Turned, it could not have taken a reaction and thus did not cast the Shield spell. The spell slot for the Shield spell is restored. Since it did not cast Shield, the flameskull was actually hit and took damage. Since it was damaged, it is no longer Turned and can now cast Shield. The paladin never finishes his turn because the flameskull is caught in an infinite recursion loop.