Why is a certain step done in the following Z transform: So the goal of this exercise is to write the X2(z) in terms of X(z). The solution is in the following image. Can someone please explain to me why the step indicated with the red arrows has been done and when should that step be done in general? I know that it eliminate odd contributions of x(k), but in another problem this step has not be done. Please look at the second image. Why is that so and when do I decide when to apply that particular transformation?
$$x_2(n) = x(2n)$$
$$X_2(z) = \sum_{n=-\infty}^\infty x_2(n)z^-n$$
$$X_2(z) = \sum_{n=-\infty}^\infty x(2n)z^-n$$
$$X_2(z) = \sum_{k=-\infty}^\infty x(x)z^{-\frac{k}{2}}$$
$$X_2(z) = \sum_{k=-\infty}^\infty \Biggr[\frac{x(k) + (-1)^k x(k)}{2}\Biggr]z^{-\frac{k}{2}}  $$ 
$$X_2(z) =\frac{1}{2} \sum_{k=-\infty}^\infty x(k)z^{-\frac{k}{2}} + \frac{1}{2} \sum_{k=-\infty}^\infty x(k){(-z^{\frac{1}{2}})}^{-k}$$
$$X_2(z) = \frac{1}{2} \Bigr[ X(\sqrt z) + X(- \sqrt z ) \Bigr]$$
Transformation of x(k) indicated by red arrows
This problem is taken from the book "Digital Signal Processing" Fourth Edition by G. Proakis. 
It is the number 3.11 of the book, here is an image of all the information the problem offers:
whether the signal is odd or even, the book does not specify. That is one of the reasons why I had difficulty understanding why the solution is the way that it is. here is a link of the book in pdf. it's on page 216  
http://jufiles.com/wp-content/uploads/2016/06/4th-Digital-Signal-Processing-Proakis-and-Manolakis.pdf
 A: Let us start from the example that does not do anything special:
$$
x_1(n) =
\begin{cases}
x(\frac{n}{2}),  & \text{$n$ even} \\
0, & \text{$n$ odd}
\end{cases}
$$
$$
\begin{align}
X_1(z)&=\sum_{n=-\infty}^{+\infty}x_1(n)z^{-n}\\
&=\sum_{n=-\infty}^{+\infty}x(\frac{n}{2})z^{-n}\\
&=\sum_{k=-\infty}^{+\infty}x(k)z^{-2k}\\
&=X(z^2)
\end{align}
$$
Why is that?
Well, if you plug the substitution $\frac{n}{2}=k$ on the description of the function, you get:
$$
x_1(2k) =
\begin{cases}
x(k),  & \text{$2k$ even} \\
\color{red}{0,} & \color{red}{\text{$2k$ odd}}
\end{cases}
$$
Obviously, the condition in red is always false and can be discarded. That way, there are no remaining constraints or restrictions imposed to the function, and consequently to its Z-Transform, which means all values of $k$ are valid.
Now, for the second case:
$$x_2(n)=x(2n)$$
$$
\begin{align}
X_2(z)&=\sum_{n=-\infty}^{+\infty}x_2(n)z^{-n}\\
&=\sum_{n=-\infty}^{+\infty}x(2n)z^{-n}\\
&=\sum_{n=-\infty}^{+\infty}x(k)z^{-\frac{k}{2}}, \color{red}{\text{$k$ even}}\\
\end{align}
$$
The restriction for the values of $k$ shows up because of the substitution $2n=k$, once there is no $n \in \mathbb{Z}$ for which the substitution holds when $k$ is odd.
What the author did in the next step was a way to write this restriction in a mathematical way so that for odd values of $k$, the sum exists, but is equal to $0$. In that way, the infinite sum can be solved for all values of $k$. Notice that:
$$
\frac{x(k)+(-1)^{k}x(k)}{2} =
\begin{cases}
x(k),  & \text{$k$ even} \\
0, & \text{$k$ odd}
\end{cases}
$$
In my opinion, what may have caused confusion is the fact that the author imposed the restriction to the values of $k$ after it was not a problem anymore. The restriction should have been made in the same line as I did.
$$
\begin{align}
&=\sum_{n=-\infty}^{+\infty}\left[\frac{x(k)+(-1)^{k}x(k)}{2}\right]z^{-\frac{k}{2}}, \color{red}{\text{$\forall k$}}\\
&=\frac{1}{2}\sum_{n=-\infty}^{+\infty}x(k)z^{-\frac{k}{2}}+\frac{1}{2}\sum_{n=-\infty}^{+\infty}x(k)(-z^{\frac{1}{2}})^{-k}\\
&=\frac{1}{2}\left[X(\sqrt{z})+X(-\sqrt{z})\right]
\end{align}
$$
So, to sum up, these kind of "tricks" must be made in order to assure that the Z-Transform sum exists whenever the original signal does. You must always have the full perspective of the change of variables you make.
Hope it was helpful.
