I got $\ a_1, \ldots,a_n $ as different real numbers and:
$$\ f(x) = \frac{1}{x-a_1} + \frac{1}{x-a_2} + \cdots + \frac{1}{x-a_n} $$
I have to find the number of the solutions in real numbers for$\ f(x) = 0$ and $\ f(x) = x$.
I notice, that:
$$\ \frac{x^{n-1}-x^{n-2}(a_1+\cdots+a_n)-x^{n-3}(\cdots }{x^n-x^{n-1}(a_1+\cdots+a_n)\cdots} $$
In nominator therre always lacks a one real number because of the multiplication to the common denominator - in denominator there are all $\ a's$.
Here I ask you for help. I'm stuck on this, although I think of derivative and comparison to i.e. $$\ x = \frac{1}{x-a_1} + \frac{1}{x-a_2} + \cdots + \frac{1}{x-a_n} $$
I would appreciate any explanation or advice.
It is known that in the complex case $\frac{p'(z)}{p(z)}=\sum_{i=1}^n\frac{1}{z-a_i}$ by the logarithmic derivative of $p$ and each term $z-a_i$. In your case you have $\frac{p'(x)}{p(x)}=0$ and thus as you noted in each interval $(a_i,a_{i+1})$, $p'(x)=0$ has exactly one real root.
For the second case I would suggest a different approach though than the one in my comment. Let $z_0\in\mathbb{C}: \sum_{i=1}^n\frac{1}{z_0-a_i}=z_0$ then $z_0=\Re(z_0)+i\Im(z_0)$ and thus if $\Im(z_0)\ne{}0$ then all $\Im(\frac{1}{z_0-a_i})$ have the same sign which is different from the sign of $\Im(z_0)$ thus forcing $\Im(z_0)=0$ and $z_0\in\mathbb{R}$