2. For the quadratic function $y=a x^{2}+b x(a b \neq 0)$, when $x$ takes $x_{1}, x_{2}\left(x_{1} \neq x_{2}\right)$, the function values are equal. Then, when $x$ takes $x_{1}+x_{2}$, the function value is
2. Let $x$ take $x_{1}, x_{2}$, the function values are $-c$, then we have
$$
\left\{\begin{array}{l}
a x_{1}^{2}+b x_{1}=-c, \\
a x_{2}^{2}+b x_{2}=-c .
\end{array}\right.
$$

That is, $x_{1}, x_{2}$ are the two distinct roots of the quadratic equation
$$
a x^{2}+b x+c=0
$$

and
$$
x_{1}+x_{2}=-\frac{b}{a} \text {. }
$$

Therefore,
$$
\begin{array}{l}
a\left(x_{1}+x_{2}\right)^{2}+b\left(x_{1}+x_{2}\right) \\
=a\left(-\frac{b}{a}\right)^{2}+b\left(-\frac{b}{a}\right)=0 .
\end{array}
$$