(Not an answer, but too long for a comment. Prompted by comments under this other question.)
For an $\,n^{th}\,$ degree polynomial with $\,n \ge 3\,$, the question whether its roots lie on a line in the complex plane relates to the question of determining whether the roots of an associated polynomial are all real.
If the roots of $\,n^{th}\,$ degree $\,P(z)\,$ are collinear, then the roots of all its derivatives must also lie on the same line by the Gauss–Lucas theorem.
Taking some liberty in assuming that all roots are distinct, it follows that the line on which all roots lie is the line through the two roots $\,a,b\,$ of the quadratic $\,P^{(n-2)}(z)=0\,$. That line can be mapped onto the real axis with a translation and/or rotation, so a necessary condition for the roots of $\,P(z)\,$ to be collinear is for all roots of $\,Q(z) = P(\omega z) - \nu\,$ to be real, for the respective $\,\omega, \nu \in \mathbb C\,$, with $\,|\omega|=1\,$, both of which can be explicitly determined from $\,a,b\,$.
In the case $\,n=3\,$ of a cubic, the quadratic in question is $\,P'(z)\,$, and that case is covered nicely in Jean Marie's answer.