Why is the shape of a stop sign an octagon?

Because, the sharpness of the edges tends to catch the eye. It is red because it's a sign of danger.