Let X a $L^2$ martingale. We want to prove that $E[(X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}|\mathcal F_s]=(X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}$.
In more than one proof I see the following approach for proving the martingale condition: $ E[(X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}(\mathbb1_{\tau\le s}+\mathbb1_{s<\tau<t}+\mathbb1_{\tau\ge t})|\mathcal F_s]$
we can see after some steps that:
$E[\big((X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}\big)\mathbb1_{s<\tau<t}|\mathcal F_s]=0$
SHOW: $$E\bigg[E\big[\big((X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}\big)| \mathcal F_{s\lor\tau} \big ]\mathbb1_{s<\tau<t}|\mathcal F_s\bigg]=E\bigg[E\big[\big((X_t-X_{s\lor \tau})^2-\langle X\rangle_t +\langle X\rangle_{s\lor\tau}\big)| \mathcal F_{s\lor\tau} \big ]\mathbb1_{s<\tau<t}|\mathcal F_s\bigg]=E[0\mathbb1_{s<\tau<t}|\mathcal F_s]=0$$
$E[\big((X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}\big)\mathbb1_{\tau\ge t}|\mathcal F_s]=0$
therefore we obtain: $$E[\big((X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}\big)(\mathbb1_{\tau<s}+\mathbb1_{s<\tau<t}+\mathbb1_{\tau>t})|\mathcal F_s]=\big((X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}\big)\mathbb1_{s<\tau}$$ and we have proved that:
$$E[(X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}|\mathcal F_s]=(X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}$$
What I don't understand is why can I remove the indicator function on the last step and conclude that it hold on the general case??
I think there are some typos. Your equation following "therefore we obtain" should read
$$E[\big((X_t-X_{t\land \tau})^2-\langle X\rangle_t +\langle X\rangle_{t\land\tau}\big)(\mathbb1_{\tau \le s}+\mathbb1_{s<\tau<t}+\mathbb1_{\tau \ge t})|\mathcal F_s]=\big((X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}\big)\mathbb1_{\tau \le s}$$ since the term that has not been shown to vanish has $\mathbb{1}_{\tau \le s}$, not $\mathbb{1}_{s < \tau}$.
Now notice that when $\tau > s$ we have $s \wedge \tau = s$ and therefore $$\big((X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}\big)\mathbb1_{\tau > s} = \big((X_s-X_{s})^2-\langle X\rangle_s +\langle X\rangle_{s}\big)\mathbb1_{\tau > s} = 0.$$
Thus, we do in fact have $$\begin{align*}\big((X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}\big)\mathbb1_{\tau \le s} &= \big((X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}\big)(\mathbb1_{\tau \le s} + \mathbb{1}_{\tau > s}) \\&= (X_s-X_{s\land \tau})^2-\langle X\rangle_s +\langle X\rangle_{s\land\tau}\end{align*}$$