Fractals are characterized by self-similarity and recursive patterns at various scales. Sometimes this complex behavior can be achieved from simple rules which typically make use of loops, recursion, or even modular arithmetic in conjunction with bit-wise operations (XOR; AND, ETC).
I had found this example a while ago and I'm still amazed at how such a complex pattern like the Sierpinski fractal can emerge in only 14 bytes of assembler code!? Truly mind-boggling.
The second example uses modular arithmetic to create a maze-like fractal pattern.