Mirror image creates 'three illusory duplicates' of you. Attacks against you may end up attacking one of them. The actual text (PHB p.260) reads:
Three illusory duplicates of yourself appear in your space. Until the spell ends, the duplicates move with you and mimic your actions, shifting position so it’s impossible to track which image is real. You can use your action to dismiss the illusory duplicates.
Each time a creature targets you with an attack during the spell’s duration, roll a d20 to determine whether the attack instead targets one of your duplicates.
[snip details of random rolls, AC of images etc]
A creature is unaffected by this spell if it can’t see, if it relies on senses other than sight, such as blindsight, or if it can perceive illusions as false, as with truesight.
I just noticed there's a rapidly-growing megathread on the GITP forums arguing over whether it affects spells that do not require an attack roll (specifically hold person). I skimmed a few pages of the debate but it seems to have got rather confused. Checking here I did find both RAW and word-of-god information strongly supporting the interpretation that it does not.
This seems pretty conclusive, and to clarify, I accept this interpretation and I'm not asking to start a debate about it. However, I'm struggling to reconcile this with my previous mental image of how this spell would appear; I always pictured an array or group of casters shuffling around like a giant shell game, which pop out of existence one by one as they are targeted. I think this was even how it looked in the old SSI D&D games, although it's been a long time since I played those. I'd like to make sure that in any games in future I can describe the spell effect in a way consistent with the way the spell works.
So what does a mirror image look like? I suppose I'm ideally looking for 'fluff as written' (the spell description alone isn't really sufficient; descriptions from official novels or rulebooks, preferably from 5e would be great) but it should at least be consistent with the facts that:
- the images occupy 'the same space' (does this mean overlapping?);
- attacks get randomised among the images;
- spells that do not require an attack roll do not get randomised (unerringly find the right image, presumably);
- creatures that do not rely on sight or that can see through illusions are unaffected.
- RAW, there is no way to track the 'real' image (by e.g. noticing they were standing on a particular floor tile before the duplicates appeared, or noting which image gets struck by a magic missile).
I think #5 is the bit I have most trouble with - what stops you from keeping track of the original caster by just keeping them in view or watching which one gets hit by magic missile? Does the caster randomly swap places with an image via a very limited blink-type effect or something?