Example 1 Why does the equation $\left|x^{2}-2 x-3\right|=k$ have four distinct real roots when $k$ is a real number?

When $k$ is a real number, the equation $\left|x^{2}-2 x-3\right|=k$ can have four distinct real roots because the expression inside the absolute value, $x^{2}-2 x-3$, is a quadratic equation that can take both positive and negative values. The quadratic equation $x^{2}-2 x-3$ can be factored as $(x-3)(x+1)$, which means it has roots at $x=3$ and $x=-1$. The graph of this quadratic equation is a parabola that opens upwards, with its vertex at the point where $x=1$ (the midpoint of the roots), and the value of the quadratic at this point is $-4$. 

When $k>0$, the equation $\left|x^{2}-2 x-3\right|=k$ can be split into two cases:
1. $x^{2}-2 x-3=k$
2. $x^{2}-2 x-3=-k$

For $k>4$, both equations will have two distinct real roots, leading to a total of four distinct real roots. For $0<k<4$, the first equation will have two distinct real roots, and the second equation will also have two distinct real roots, again leading to a total of four distinct real roots. When $k=4$, the equation $x^{2}-2 x-3=-4$ has a double root at $x=1$, and the equation $x^{2}-2 x-3=4$ has two distinct real roots, leading to a total of three distinct real roots. For $k=0$, the equation $\left|x^{2}-2 x-3\right|=0$ has exactly two distinct real roots, which are the roots of the quadratic equation $x^{2}-2 x-3=0$. For $k<0$, there are no real roots because the absolute value of a real number cannot be negative.
Let $y=f(x)=\left|x^{2}-2 x-3\right|$, then the graph of $f(x)$ is shown in Figure 5-1. The line $y=k$ is a horizontal line parallel to the $x$-axis. The original equation has four distinct real roots, meaning the line $y=k$ intersects the curve at four different points. From the graph, we can see that when $0<k<4$, the line intersects the curve at four different points, which means the equation has four distinct real roots.