Let $(X_n)$ with $n \in \mathbb N_0$ be a discrete martingale. Then I read the following identity which is said to be derived from the law of total probability.
$$ \mathbb EX_m = \left( \sum_{n=0}^m \mathbb E \left[ X_m \mathbb 1_{\{ X_0<\lambda, \cdots, X_{n-1}<\lambda, X_n\geq \lambda \}} \right] \right) + \mathbb E \left[ X_m \mathbb 1_{\{ X_0<\lambda, \cdots, X_m<\lambda \}} \right] $$
I could not see why this follows from the law of total probability.
In addition, how to interpret $\mathbb E \left[ X\mathbb 1_{\{\cdot\}} \right]$ in the first place?
An indicator function has a value of $1$ when the parameters are within the given range, and a value of $0$ otherwise.
$\operatorname{\bf 1}_{\{X_0<\lambda,\cdots,X_{n−1}<\lambda,X_n\ge\lambda\}} = \begin{cases} 1 & : X_0<\lambda,\cdots,X_{n−1}<\lambda;X_n\ge\lambda \\ 0 & :\text{elsewhere}\end{cases}$
Let's look at a sample case. Consider $\forall n\in\{0,1,2\}:X_n\sim {\cal U}[0,1], \mathrm{i.i.d}$, and use $\lambda = \frac 23$
Then $$\begin{align} \mathsf E[X_2 \operatorname{\bf 1}_{\{X_0\ge 2/3\}}] &= \int_0^1\int_0^1 f_{X_0,X_2}(x_0,x_2)\;x_2\;\operatorname{\bf 1}_{\{X_0\ge 2/3\}} \operatorname{d}x_0\operatorname{d}x_2 \\ & = \int_0^1 x_2 \;f_{X_2}(x_2)\int_{2/3}^1 f_{X_0}(x_0)\operatorname{d}x_0\operatorname{d}x_2 \\ & = \frac {1}{6} \\[2ex] \mathsf E[X_2 \operatorname{\bf 1}_{\{X_0 < 2/3, X_1\ge 2/3\}}] & = \int_0^1 x_2 \;f_{X_2}(x_2)\int_{2/3}^1 f_{X_1}(x_1)\int_0^{2/3}f_{X_0}(x_0)\operatorname{d}x_0\operatorname{d}x_1\operatorname{d}x_2 \\ & = \frac {1}{9} \\[2ex] \mathsf E[X_2 \operatorname{\bf 1}_{\{X_0 < 2/3, X_1< 2/3,X_2\ge 2/3\}}] & = \int_{2/3}^1 x_2 \;f_{X_2}(x_2)\int_0^{2/3} f_{X_1}(x_1)\int_0^{2/3}f_{X_0}(x_0)\operatorname{d}x_0\operatorname{d}x_1\operatorname{d}x_2 \\ & = \frac {2}{27} \\[2ex] \mathsf E[X_2 \operatorname{\bf 1}_{\{X_0 < 2/3, X_1< 2/3,X_2 < 2/3\}}] & = \int_0^{2/3} x_2 \;f_{X_2}(x_2)\int_0^{2/3} f_{X_1}(x_1)\int_0^{2/3}f_{X_0}(x_0)\operatorname{d}x_0\operatorname{d}x_1\operatorname{d}x_2 \\ & = \frac {4}{27} \\[2ex] \frac 1 6+\frac 1 9+\frac 2{27}+\frac 4{27} & = \frac 1 2 \end{align}$$