The video below shows large columns, made up of small line-segments. The columns appear to swing from side to side, like tilted towers. In reality, of course, the columns and line-segments are perfectly vertical. The perceived tilt is illusory.
So what's going on here?
This illusion is a nice demonstration of Gestalt theory, a German a school thought that was developed in the early 20th century by Kurt Koffka, Wolfgang Köhler, and Max Wertheimer. Theories in psychology tend to become outdated rather quickly, but Gestalt theory is a notable exception. It is as relevant today as it was a century ago.
In German, Gestalt means 'shape', but in this context it refers to something that is greater than the sum of its parts, or a 'unified whole'. Which, according to the Gestalt psychologists, is a good characterization of perception. If we see a chair, for example, we don't consider the parts of the chair separately, one at a time. ("I see a leg, uhm, another leg... and something that could be a seat.") We simply see a chair. We can see that a chair has legs, of course, but the perception of the chair as a whole comes first. In other words, we automatically group objects together into a single, coherent percept.
This tilt illusion is the result of perceptual grouping. More specifically, in this case we group those line-segments together that are adjacent (law of proximity) and have the same colour (law of similarity). You can see an illustration of this in (a) in the figure below. There are always two consecutive line-segments that are perceptually bound together.
By itself, grouping does not explain the illusion. For this we need to consider as well how each line-segment pair is interpreted by our visual system. This is shown in (b). Because the line-segments are 'jagged', each line-segment pair has a slight tilt. If the top line-segment is displaced a bit to the left, the line-segment pair will appear to be tilted a bit to left. We do not (or hardly) perceive the jaggedness, because it is too fine-grained. Instead, we perceive a more-or-less smooth tilt. The colouration is such that within a column each line-segment pair has the same tilt. Therefore, the column as a whole appears to be tilted as well.
So, in sum, the illusory tilt of a column is determined by how we group together the line-segments that make up the column. By switching the colours we can change the grouping, thus making the column swing from left to right!