I should state that the following steps depend on the formula for a geometric series:
$$\sum_{j=1}^{k} r^{j-1} = \frac{1-r^k}{1-r}$$
The sum in question is
$$p_1 p_2 \sum_{j=1}^{k-1} (1-p_2)^{j-1} \sum_{i=1}^{k-j} (1-p_1)^{i-1} $$
Evaluate the inner sum first:
$$\sum_{i=1}^{k-j} (1-p_1)^{i-1} = \frac{ 1 - (1-p_1)^{k-j} }{p_1} $$
Now the sum is
$$\begin{align} p_2 \sum_{j=1}^{k-1} (1-p_2)^{j-1} \left [ 1 - (1-p_1)^{k-j} \right ] &= 1 - (1-p_2)^{k-1} - p_2 \sum_{j=1}^{k-1} (1-p_2)^{j-1} (1-p_1)^{k-j} \\ \end{align} $$
The sum on the right-hand side may be evaluated as follows:
$$\begin{align}\sum_{j=1}^{k-1} (1-p_2)^{j-1} (1-p_1)^{k-j} &= (1-p_1)^{k-1} \sum_{j=1}^{k-1} \left ( \frac{1-p_2}{1-p_1} \right )^{j-1} \\ &= (1-p_1)^{k-1} \frac{ 1 - \left ( \frac{1-p_2}{1-p_1} \right )^{k-1}}{1 - \frac{1-p_2}{1-p_1}} \\ &= (1-p_1)\frac{(1-p_1)^{k-1} - (1-p_2)^{k-1}}{p_2-p_1} \\ \end{align} $$
Now we can put this all together:
$$\begin{align} 1 - (1-p_2)^{k-1} - p_2 (1-p_1)\frac{(1-p_1)^{k-1} - (1-p_2)^{k-1}}{p_2-p_1} \\ = 1 - \frac{(p_2-p_1)(1-p_2)^{k-1} + p_2 (1-p_1)[(1-p_1)^{k-1} - (1-p_2)^{k-1}]}{p_2-p_1} \\ \end{align}$$
which, after some cancellation and consolidation, produces the following result for the sum:
$$1 - \frac{p_1 (1-p_2)^k - p_2 (1-p_1)^k}{p_1-p_2}$$
and is equal to the result stated above.
They didn’t just interchange the index variables in that first example: they exploited the fact that doing so does not change the sum. Thus, they were able to write
$$2S=\sum_{1\le j<k\le n}(a_k-a_j)(b_k-b_j)+\sum_{1\le k<j\le n}(a_j-a_k)(b_j-b_k)\;,$$
getting a sum in which every possible term of the form $(a_i-a_\ell)(b_i-b_\ell)$ with $1\le i,\ell\le n$ appears except those in which $i=\ell$.
It may help to think of this in matrix terms. For $1\le j,k\le n$ let $c_{j,k}=(a_k-a_j)(b_k-b_j)$, and let
$$C=\begin{bmatrix}c_{1,1}&\color{red}{c_{1,2}}&\color{red}{\ldots}&\color{red}{c_{1,n-1}}&\color{red}{c_{1,n}}\\
\color{blue}{c_{2,1}}&c_{2,2}&\color{red}{\ldots}&\color{red}{c_{2,n-1}}&\color{red}{c_{2,n}}\\
\color{blue}{\vdots}&\color{blue}{\vdots}&\ddots&\color{red}{\vdots}&\color{red}{\vdots}\\
\color{blue}{c_{n-1,1}}&\color{blue}{c_{n-1,2}}&\color{blue}{\ldots}&c_{n-1,n-1}&\color{red}{c_{n-1,n}}\\
\color{blue}{c_{n,1}}&\color{blue}{c_{n,2}}&\color{blue}{\ldots}&\color{blue}{c_{n,n-1}}&c_{n,n}
\end{bmatrix}\;;$$
then $S$ is the sum of the (red) entries above the main diagonal of $C$, and the sum with the indices interchanged is the sum of the (blue) entries below the main diagonal of $C$. In this very special case the matrix $C$ happens to be symmetric, so the two sums are equal. Nicer yet, the entries on the main diagonal are all $0$, so the sum of all the entries in $C$ is $2S$. Thus, $2S$ is just the sum of all possible products of the form $(a_k-a_j)(b_k-b_j)$ with $1\le j,k\le n$, which is very easy to compute after we rewrite $(a_k-a_j)(b_k-b_j)$ as $a_kb_k-a_kb_j-a_jb_k+a_jb_j$.
What makes this work is the symmetry of the matrix $C$: this is one of the ‘important special cases’ mentioned in the sentence in the middle of page $36$. Learning to recognize them is to a great extent a matter of experience. In general, though, the first thing to do is see whether you can simply evaluate the summations in order as they’re written; if that doesn’t look promising, the next step is to see whether you can reverse the order of summation and get something nicer. Neither of these approaches looks very attractive in the problem above, so at that point you look for some other idea. Recognizing that a summation over $1\le j<k\le n$ or $1\le j\le k\le n$ is a summation over the upper half (give or take the diagonal) of an $n\times n$ matrix, you can reasonably look to see whether the whole matrix would be easier to work with and whether there’s an exploitable relationship between the upper and lower halves. Here both of those turn out to be the case.
Best Answer
No, the index variable can only appear inside the sum that uses this index variable.
A sum such as $\displaystyle\sum_{x=1}^3 (2x+y)$ represents a quantity that does not depend on any object named $x$. This sum is the same as $\displaystyle\sum_{b=1}^3 (2b+y)$ or $(2+y)+(4+y)+(6+y)$. It depends on the value of $y$ because $y$ is not the sum index.
Edit: The rule is that $$\sum_{x}\sum_{y} q(x, y) = \sum_{x}\left(\sum_{y} q(x, y)\right)$$ If we take your last expression it would be $$\eqalign{\sum_{y=1}^x \sum_{x=1}^3 (2x+y) &= \sum_{y=1}^x \left(\sum_{x=1}^3 (2x+y)\right)\cr &= \sum_{y=1}^x \big((2+y)+(4+y)+(6+y)\big)\cr &= \sum_{y=1}^x (12+3y) }$$ But now we have an undefined quantity $x$ in the bounds of the sum. It is meaningless.