I would like to calculate the CDF of sum of two random variable in a unit square I realize that everywhere says if X+Y=z and then if z is between 0 and 1 then probability is equal to something and if z is between 1 and 2 then probability is something else.
Yes. Assuming that the random variables $X, Y$ are continuous, that the support of each of them is $[0;1]$, and that you know their joint probability density $f_{X,Y}(x,y)$, then the culmulative density function of their sum is:
$$\mathsf P(X+Y\leq z) = \begin{cases} 0 & : z< 0
\\[2ex]
\int\limits_0^z\;\int\limits_0^{z-x} f_{X,Y}(x,y)\operatorname d y\operatorname d x & : 0 \leq z \leq 1
\\[2ex]
\int\limits_0^{z-1}\;\int\limits_0^{1} f_{X,Y}(x,y)\operatorname d y\operatorname d x +
\int\limits_{z-1}^1\;\int\limits_0^{z-x} f_{X,Y}(x,y)\operatorname d y\operatorname d x & : 1 < z \leq 2
\\[1ex]
1 & : 2 < z\end{cases}$$
Can anyone please explain how to figure out how to break down the conditions for calculating the CDF? how do I know I have to break it to two conditions like saying if z is between this to this?
The boundaries on the integrals are because if the supports are $0\leq X\leq 1$ , and $0\leq Y\leq 1$, then if we're looking for the probability in the interval: $0\leq X+Y \leq z \leq 2$ that means that we're integrating over: $$(0\leq x\leq \min(1, z)) \;\times\; (0\leq y\leq z-x) \;:\; (0\leq z\leq 2)$$
Which we split into the two intevals depending on the value of $z$
$$(0\leq x\leq z) \;\times\; (0\leq y\leq z-x) \;:\; (0\leq z \leq 1)\tag{1}$$
$$(0\leq x\leq 1) \;\times\; (0\leq y\leq \min(z-x)) \;:\; (1< z \leq 2) \tag{2}$$
what will happen if I do not do that?
You'll likely get the wrong answer.