I am not able to understand the proof of below
$$\mathbb{E}[X|A] = \frac{1}{P[A]}\mathbb{E}[X\cdot\mathbb{I_A}]$$
Specifically, some books imply that $$X=\sum_{k=0}^{\infty} k\cdot\mathbb{I}_{X=k}$$
Can you please explain the meaning of above statement?
The line $X = \sum_{k = 0}^\infty k \cdot \mathbb{I}_{X = k}$ makes use of the fact that the indicator variable $\mathbb{I}_{X = k}$ is defined to equal 1 when $X = k$, and 0 otherwise. So as long as $X$ is guaranteed to take some non-negative integer value, all we're doing is writing a convoluted form of it - it's the sum of a whole bunch of zero values, plus for some value $k$ it's equal to $k \times 1$.