The context here is the construction of the stochastic integral. In this setting, one defines elementary processes that can be written as: $$ K_t=\sum_{i=0}^{k}X_{a_i}\mathbb{1}_{t \in (a_i,a_{i+1}]} $$ with $X_{a_i}$ being $\mathcal{F}_{a_i}$-measurable and in $L^2$. Now, given a continuous martingale $N$ bounded in $L^2$, and an elementary process $K$, the following formula holds $\forall t \geq 0$:
$$ \langle I(K),N \rangle_t = \int_0^{t} K_s d\langle B,N\rangle_s $$ where $I(K)$ indicates the stochastic integral. I want to prove this equality, but I can't even write down what the left hand side would actually be in this specific case.
$I(K)_t = \sum_{i=0}^kX_{a_i}(B_{a_{i+1}\wedge t}-B_{a_i\wedge t})=\sum_{i=0}^kX_{a_i}(B^{a_{i+1}}-B^{a_i})_t$, where we denote $Y^a_t:=Y_{a\wedge t}$. Then $$ \begin{align*} \langle I(K),N\rangle_t&=\sum_{i=0}^k\langle X_{a_i}(B^{a_{i+1}}-B^{a_i}),N\rangle_t\\ &=\sum_{i=0}^kX_{a_i}\langle B^{a_{i+1}}-B^{a_i},N\rangle_t\\ &=\sum_{i=0}^kX_{a_i}(\langle B,N\rangle_{a_{i+1}\wedge t}-\langle B,N\rangle_{a_i\wedge t})\\ &=\sum_{i=0}^kX_{a_i}\int_0^t1_{(a_i,a_{i+1}]}(s)\,d\langle B,N\rangle_s\\ &=\int_0^t\sum_{i=0}^kX_{a_i}1_{(a_i,a_{i+1}]}(s)\,d\langle B,N\rangle_s\\ &=\int_0^tK_s\,d\langle B,N\rangle_s. \end{align*} $$
EDIT: let's clarify why the second equality hold. Let $Z:=B^{a_{i+1}}-B^{a_i}$ and $M_t=Z_tN_t-\langle Z,N\rangle_t$. So we want $\langle X_{a_i}Z,N\rangle=X_{a_i}\langle Z,N\rangle$, which amounts to say that $X_{a_i}ZN-X_{a_i}\langle Z,N\rangle=X_{a_i}M$ is a local martingale, or equivalently, $\langle X_{a_i},M\rangle=0$. The latter is straightforward, since for any stopping time $T$, $\langle X_{a_i},M^T\rangle=\langle X_{a_i}^T,M\rangle$. Therefore, for $T=a_i$, and noticing that $M^{a_i}=0$, we get $\langle X_{a_i},M\rangle=0$, which proves the claim.
For the sake of clarity I deliberately not mentionned measurability issues. If you want the proof to be complete, you should also verify that the process $X_{a_i}\langle Z,N\rangle$ is indeed adapted. It is for instance a consequence of the fact that $$ X_{a_i}\langle Z,N\rangle_t=X_{a_i}(\langle B,N\rangle_{a_{i+1}\wedge t}-\langle B,N\rangle_{a_i\wedge t})=X_{a_i}1_{\{t>a_i\}}(\langle B,N\rangle_{a_{i+1}\wedge t}-\langle B,N\rangle_{a_i\wedge t}). $$