I have this doubt abuot the following equivalence. Let X a real valued-random variable and let $a\in\mathbb{R}$, is it true that
$$X=X\mathbb{1}_{\{X\leq a\}}+X\mathbb{1}_{\{X> a\}}?$$
I found that if X takes values in a countable set S of outcomes it is ture that
$$X=\sum_{x\in S}x\mathbb{1}_{\{X=x\}}$$
but I do not understand if the countability is required just to have a countable number of summands or if it is actually an foundamental property of the state space.
It is true, and we don't need to argue from the countable case. We know that $X$ will either take on a value $\leq a$ or a value $> a$, and never both. In the first case, the first term in the sum will have the value of $X$, and the second term in the sum will have the value of $0$; in the second case, the first term in the sum will have the value of $0$, and the second term in the sum will have the value of $X$. Either way, they will sum to the value of $X$.