An optical illusion is a visually perceived image, characterized by their misleading and deceptive nature. The trick that lies behind optical illusions is that the images that our brain interprets from them, does not tally with their physical measurements.
Basically, there are two types of illusions: Physiological and Cognitive. But there are a few of them which make the eye feel like there is no illusion at all!
Physiological Illusions
Physiological illusions are those illusions produced as a result of excessive stimulation of a specific type, like depth, color and movement.

For example, in the above picture, the two blocks, A and B appear to have different colors. But they actually are of the same color. When they are joined with using the color, this can be clearly understood, as in the picture shown below.

Even the afterimages that we see after sudden flashes of bright light can be classified as physiological illusions.
Cognitive Illusions
Those illusions which arise due to the conflict between the interpretation of the stimulus and our true knowledge are cognitive illusions. In simple words, these stimuli appear to be illusions because we understand that what we are seeing is incorrect.
Cognitive illusions are further divided into four types:
Ambiguous:
Ambiguous illusions are formed due to the mutual existence of two or more figures in the same stimulus.
A famous example of an ambiguous illusion is the Rubin Vase shown below. Note how the vase becomes more prominent than the two faces, when the colors are swapped.


Distorting:
These are those illusions which appear to be what they are not, due to distracting factors like color and size. For example, in the Muller-Layer Effect image below, the lower line appears to be longer than the upper one.

Paradox:
Paradox illusions are generated by stimuli that clearly show us the impossible, by means of supporting features. Such an illusion is seen in M. C. Escher's painting, Waterfall shown below, where the water is shown as flowing through a passage, that is practically impossible to be constructed. Note that the image would appear quite normal if the supporting features, of the towers, were removed.

Fictional:
These are illusions that do not actually exist for everybody. That is, one and only one observer amongst a crowd of many may be able to see the illusion. Commonly, fictional illusions are called hallucinations.
Common examples are those illusions experienced by patients of Parkinson's disease or Lewy Body Dementia.