Consider $x^3+px=q$. Substituting $x:=w-\frac{p}{3w}$ will reduce it to $w^3-\frac{p^3}{27w^3}-q=0$. Multiplying with $w^3$ will result in $(w^3)^2-qw^3-\frac{1}{27}p^3=0$. Using the quadratic formula, we get$$w^3=-\frac{q\pm \sqrt{q^2+\frac{4}{27}p^3}}{2}$$
So this would imply that if $q^2<-\frac{4p^3}{27}$, there would be no solution in the real numbers. But shouldn't there always be a realy solution?
When $q^2<-\frac{4p^3}{27}$, $w^3$ becomes a complex number and there are three distinctive complex values for $w$ once the cubit root is taken on $w^3$.
The solution to the cubic equation $x^3+px+q$ is instead,
$$x=w-\frac{p}{3w}$$
As a result, there are three distinctive roots for $x$ evaluated from the three $w$’s. However, the roots result in real value due to the cancellation of the imaginary parts of $w$ and $ -\frac{p}{3w}$.
Edit: The solutions to $x^3-\lambda x +2=0$, asked in comments.
Three cases:
1) If $\lambda=3$, i.e. $q^2+\frac{4p^3}{27}=0$, there are three real roots, one double and one single.
$$x_1= -2,\>\>\>\>\>x_{2,3}=1$$
2) If $\lambda<3$, there are three mixed roots, one real and two complex. The real root is given by
$$x_1= \left( -1+\sqrt{1-\frac{\lambda^3}{27}} \right)^{1/3} + \left( -1-\sqrt{1-\frac{\lambda^3}{27}}\right)^{1/3}$$
3) If $\lambda>3$, there are three distinctive real roots. Normally they are given by their trigonometric forms as follows,
$$x_1=2\sqrt{\frac {\lambda}{3}} \cos\theta$$
$$x_2=2\sqrt{\frac {\lambda}{3}} \cos\left( \theta-\frac{2\pi}{3}\right)$$
$$x_3=2\sqrt{\frac {\lambda}{3}} \cos\left( \theta-\frac{4\pi}{3}\right)$$
where,
$$\theta= \frac13 \cos^{-1}\left( -\frac{3}{\lambda}\sqrt{\frac{3}{\lambda}}\right)$$