if $f_{x,y}(x,y)= I_{(0,1)}(x) I_{(0,1)}(y) $ find the density of $Z$, where
$$Z= (X+Y) I_{(-\infty,1]} \hspace{.2cm} (X+Y) + (X+Y-1)I_{(1,\infty)} \hspace{.1cm} (X+Y) .$$
I know that $V=X+Y$ has the following distribution
$$f(v) = v I_{(0,1]} \hspace{.1cm}(v) + (2-v)I_{(1,2)} \hspace{.1cm} (v) $$
the solution puts it this way
$P[Z \leq z]= P[X+Y \leq z ; X+Y \leq 1] +P[X+Y-1 \leq z; X+Y>1] $
$=P[ X+Y \leq z ]+ P[ 1 < X+Y \leq z+1 ] = z I_{(0,1)}\hspace{.1cm} (z)$
so Z is uniformly distributed over (0,1).
but I don't understand this solution, could you explain to me, or if there is another solution.
The solution omits some important steps and for that reason, I think it is sloppy. The main problem is that the result is incorrect: $$\Pr[Z \le z] = \begin{cases} 0, & z < 0 \\ z, & 0 \le z \le 1 \\ 1, & z > 1. \end{cases}.$$ Writing it as $z I_{(0,1)}(z)$ is plainly flawed since this would suggest the CDF is zero for $z \ge 1$. As such, we cannot actually write $$\Pr[(X+Y \le z) \cap (X+Y \le 1)] = \Pr[X+Y \le z].$$ This is, I repeat, sloppy. The correct reasoning proceeds as follows:
$$\begin{align*} \Pr[Z \le z] &= \Pr[(Z \le z) \cap (X+Y \le 1)] + \Pr[(Z \le z) \cap (X+Y > 1)] \\ &= \Pr[(X+Y \le z) \cap (X+Y \le 1)] + \Pr[(X+Y-1 \le z) \cap (X+Y > 1)] \\ &= \Pr[X+Y \le \min(z, 1)] + \Pr[1 < X+Y \le z+1]. \end{align*}$$
Now, there are three cases to consider. In the first case, $z < 0$ results in both probabilities being zero since $\Pr[X + Y < 0] = 0$ and $\Pr[1 < X+Y < 1] = 0$. In the second case $z > 1$ gives $$\Pr[Z \le z] = \Pr[X+Y \le 1] + \Pr[1 < X+Y \le z+1] = \Pr[X+Y \le z + 1] = 1,$$ since $z > 1$ implies $z+1 > 2$ and because $X+Y \le 2$ on $[0,1]^2$, the claim follows. The only case remaining is $0 \le z \le 1$. In this situation, we have $$\Pr[X+Y \le z] = \frac{z^2}{2},$$ since the set of points $(X,Y) \in [0,1]^2$ satisfying $X+Y \le z$ comprise the triangle with vertices $(0,0)$, $(z,0)$, and $(0,z)$. We also have $$\Pr[1 < X+Y \le z+1] = 1 - \Pr[X+Y \le 1] - \Pr[X+Y > z+1] = 1 - \frac{1}{2} - \frac{(1-z)^2}{2}$$ using similar reasoning as above. This gives $$\Pr[Z \le z] = \frac{z^2}{2} + \frac{1}{2} - \frac{(1-z)^2}{2} = z$$ as desired. This completes the calculation.