How many nonzero solutions can the equation $x_{1}+x_{2}+\dots+x_{n}=1$ have? Given an equation $x_{1}+x_{2}+\dots+x_{n}=1$ in the finite field $\mathrm{GF}(q)$ or $\mathbb{F}_{q}$. How many nonzero solutions can it have? I have tried paring the $x_{i}$ like 1 with -1 and then leave the odd term to be 1. But this method seems too rudimentary. 
 A: Let $A=\{(x_1,\dots,x_n)\mid \sum x_i = 1, x_i\in\mathbb F_q\}$. So $A$ includes solutions where the $x_i$ can be zero, and $|A|=q^{n-1}$. Let $A_i$ be the set of elements of $A$ with $x_i=0$. You are seeking:
$$|A\setminus(A_1\cup A_2\cup\cdots \cup A_n)|$$
So this is a job for inclusion-exclusion.
$$|A\setminus(A_1\cup A_2\cup \cdots \cup A_n)|=\sum_{i=0}^{n-1} (-1)^{i}\binom{n}{i}q^{n-i-1} =\frac{(q-1)^n-(-1)^n}{q}$$
So, for example, when $q=2$, then the number of solutions is $1$ if $n$ is odd and zero if $n$ is even.

Another approach is to think in terms of matrices. Let $a_x(n)$ be the number of ways of writing $x\in\mathbb F_q$ as the sum of $n$ non-zero elements of $\mathbb F_q$. Then we see that $a_x(n+1)=\sum_{y\neq x} a_y(n)$, and $a_x(0)=\begin{cases}1&x=0\\0&x\neq 0\end{cases}$. This can be written by written $a_*(n)$ as a vector $\mathbf a_n$ then:
$$\mathbf a_n = (J-I)^na_0$$
Where $J$ is the $q\times q$ matrix of all ones, and $I$ is the identity matrix.
Now, $J-I$ has eigenvalue $-1$ with all vectors $(v_0,\dots,v_{q-1})^T$ with $\sum v_i=0$ and eigenvalue $q-1$ with eigenvector $(1,1,1,\dots,1)^T$.
So write $(1,0,0,\dots,0)$ in terms of these eigenvectors. Then:
$$(1,0,\dots,0)^T=\frac{1}{q}(1,1,1,\dots,1)^T+\frac{1}{q}(q-1,-1,-1,\dots,-1)^T$$
Writing $v_{q-1}=(1,1,\dots,1)^T$ and $v_{-1}=(q-1,-1,-1,\dots,-1)^T$ we see that:
And thus $$(J-1)^n (1,0,\dots,0)^T=\frac{1}{q}\left((q-1)^n v_{q-1}+(-1)^{n}v_{-1}\right)$$
This means that 
$$a_n(x)=\begin{cases} \frac{(q-1)^n + (-1)^n(q-1)}{q}&x=0\\
\frac{(q-1)^n-(-1)^n}{q}&x\neq 0\end{cases}$$
This matrix is essentially the same as Andre's approach - the polynomial $x^2-(q-2)x-(q-1)$ is just a way of stating the same recursion that he found.
A: Let $a_n$ be the number of non-zero solutions. Then for any fixed non-zero element $c$, there are $a_n$ non-zero solutions of $x_1+\cdots +x_n$. For we can go back and forth from sum $1$ to sum $c$ by multiplying through by a suitable constant.
We first count the number of solutions that have $x_n\ne 1$. This is $(q-2)a_{n-1}$. For $x_n$ can be chosen in $q-2$ ways. And for each such choice  $c$ we need to count the number of non-zero solutions of $x_1+\cdots+x_{n-1}=1-c$. There are $a_{n-1}$ of these.
For the solutions with $x_n=1$, the term $x_{n-1}$ can be any non-zero element $d$, as long $x_1+\cdots+x_{n-2}=-d$. So there are $(q-1)a_{n-2}$ solutions. 
We have obtained the recurrence
$$a_n=(q-2)a_{n-1}+(q-1)a_{n-2}.$$
The characteristic polynomial is $x^2-(q-2)x-(q-1)$, which has roots $q-1$ and $-1$.
Thus $a_n=A(q-1)^n+B(-1)^n$. The constants $A$ and $B$ can be found by using $a_0=0$, $a_1=1$. We get $A=\frac{1}{q}$ and $B=-\frac{1}{q}$.
