Is there a way to find out how many distinct roots a polynomial has? Let say we have an arbitrary polynomial over the reals, and we do not know whether it is separable or not. Is there some algorithm to find the number of roots it has in the complex number? 
 A: If $f(z) = \prod (z-z_i)^{n_i}$, with $z_i$ distinct, then $GCD(f(z), f'(z)) = \prod (z-z_i)^{n_i-1}$, so the number of distinct complex roots is $\deg f - \deg GCD(f, f')$. If $f$ has rational coefficients, or in some other sense can be computed with exactly, this is a practical method; polynomial GCD can be computed by the Euclidean algorithm. If the coefficients of $f$ are only known approximately, then you need to think about what you mean by number of roots, since perturbing $x^2$ (one root) can give $x^2-\epsilon$ (two roots).
Also, if you meant to ask how many real roots there are, see Sturm's theorem.
A: Yes, there is. The key is the square-free factorization which is an algorithm for factoring a polynomial $f$ into
 $f=f_1^{e^1}\cdots f_r^{e_r}$, where all the $f_i$ are square free.
In your case, the number of complex roots would then be the degree of $f_1\cdots f_r$.
Look for example in von zur Gathen, J.  and Gerhard, J. Modern Computer Algebra. Cambridge, England: Cambridge University Press, pp. 601-606, 1999. 
