Sundogs, also known as mock suns or "parhelia", are a pair of brightly
colored spots, one on either side of the Sun.

Sun Dogs are created when light passes through ice crystals as they
fall through a cloud. The ice crystals act exactly the same as a glass
prism, bending the light and seperating the colors. Since the amount
the light bends depends on the color (red bends less than green and blue)
the red looks closer to the sun than the blue. The amount of bending
is always the same, so sundogs always appear the same distance away
from the sun.

The reason you usually only see sundogs near sunrise or sunset is
because the shape of the ice crystal and the way it falls. Ice crystals
that form sundogs are shaped like thin hexagonal (or six sided) plates.
They fall like leaves, keeping the flat side up and down. You can
picture this if you stick your hand out, fingers spread, with your
palm facing down. The ice crystals are shaped a little like that.
In order for sundogs to form, the light has to enter along the thin
side. If you look at your hand, the light must come in from your arm and
will bend into colors so that it comes out your fingers (different colors
for different fingers). The only time you would see a color is if you
were looking right along your finger.

So, in order to have sundogs, you need to have the right kind of
clouds (the kind with these thin ice crystals) which are not too thick
so that the sun can directly light them up, and the right angle so that
the sunlight can pass through the proper side of the crystal so you
can see the scattered light. As you might imagine, with all that you
need to have happen, sundogs are not seen very often.