If you're asking what it does, it doesn't DO anything, it just
IS.
If you're asking what it's due TO, that depends on what specific
illusion you're talking about. Some of them are due to our
expectations, some are due to idiosyncrasies in our physiology or
psychology, and some of them are due to actual physical
phenomena.