The images interpreted by your eyes aren't quite what your brain sees. Your eyeball acts like a lens, and inverts the picture of the world, which is then projected onto the back of the eyeball. The tiny rods and cones in the back of the eyeball are the organs that turn the picture into something the brain can understand. Your brain takes that upside-down picture, flips it over, fills in the gaps, then shows you how it looks--all within a split second. It's a complicated process, and because it's so complex, there is room for confusion.
One of the most commonly exploited optical glitches is the blind spot. Your eyes see a large amount of information, but there are certain areas of the eye that don't receive any light. Your pupil, for example, shuts out light to the center of the eye, and there are areas that exist beyond your periphery. Your brain simply fills in the gaps in that information--so, for example, an artist can draw a picture that's too large to fit in your focal area (the main area in your vision), featuring one side of the picture that appears one way, while the other side looks different.
Your brain makes many assumptions about visual information. It uses previous experience to make judgments about things like size and distance. So, for example, in the accompanying picture of the streetlights, your brain assumes that the tallest item on the page is the largest--because objects you've seen before which appear taller, usually are larger. What you don't necessarily notice is that the middle-most streetlamp is actually raised up on steps, while the other is not--meaning the two are the same size.
Another common visual illusion employs afterimages. If you stare at a brightly-colored object for a long time, the receptors in your eyes--the rods and cones--start to get tired, which makes them unreliable. When you turn your head to look at something else, those rods and cones are still looking for that bright color, creating an afterimage. That colored patch on the wall isn't there, but your eyes are trying to tell your brain that it is.
The brain becomes even more confused when certain motion is introduced. For example, if you look at an animated .gif image of a wheel turning, your brain tries to interpret that movement as turning because it's seen wheels turn before. In actuality, .gif images are made of stationary pictures that switch back and forth. This is also how films and movies work--in reality, a TV show is simply made up of dozens of individual pictures per second all played rapidly in succession. Your brain, because it sees a person on one side of the screen, then he's a little closer to the other side, assumes he's walking just like any other person would.