Illusions distort the world around a player causing them to do crazy things. They can be broken by losing hearts, death, eating golden apples or entering a different dimension and will last for up to 1 minecraft day.
Effects from an illusion include creating mobs, dealing damage, moving blocks, clearing your inventory and inventing new biomes but this is all for show. Your movements and actions in the fake world created by the illusion effect the real world as well. Illusions are caused if you return to the real world after long periods in the nether, exposure to red stone, spending too long in the dark or after the blindness effect has worn off. For each of these circumstances they is a 11.2 % chance you will hallucinate.
In multiplayer illusions can be broken by other players interacting with you.