It may be that this question has been asked before, but the search function did not revel anything in this area.
In reading some old lecture notes on stochastic calculus I have encountered the following reasoning: $$ \int H^2d\langle M\rangle=\int H^2d\langle M,M\rangle=\int H d\langle H \boldsymbol{\cdot} M,M\rangle=\langle H \boldsymbol{\cdot} M, H \boldsymbol{\cdot} M\rangle=\langle H \boldsymbol{\cdot} M\rangle $$
I am not quite sure I understand where the second and third equality signs come from.
In this particular material the stochastic integral of $H\in L^2(M)$ with respect to $M\in\mathcal{M}^c_{\text{0,loc}}$ is defined as the unique process $H\boldsymbol{\cdot}M\in\mathcal{H}^{2,c}_0$ satisfying the relation: $$ \langle H\boldsymbol{\cdot}M, N\rangle = \int H d \langle M,N\rangle, (\forall) N\in\mathcal{M}^c_{\text{0,loc}}, $$ where $\mathcal{M}^c_{\text{0,loc}}$ is the set of continuous local martingales null at zero and for each $M\in \mathcal{M}^c_{\text{0,loc}}$ I define $L^2(M)$ to be the set of all equivalence classes of predictable processes $H=(H_t)_{t\geq t}$ with the property that: $$ \newcommand{\norm}[1]{\left\lVert#1\right\rVert} \mathbb{E}_M[H^2]=\norm {H}^2_{L^2(M)}=\mathbb{E}\Big[ \int_0^\infty H^2_sd\langle M\rangle_s \Big] < +\infty, $$ where two processes $H$ and $H'$ are considered to be the members of the same equivalence class if $\norm{H-H'}_{L^2(M)}=0$. Finally, $\mathcal{H}^{2,c}_0$ is the set of all continuous RCLL $(P,\mathbb{F})$-martingales, null at $t=0$ with the property that $$ \sup_{t \geq 0} \mathbb{E}[M_t^2]<\infty. $$
I would be very grateful if you could point me to a reference that can help in proving the above.
The integral in the RHS of the definition of $M\boldsymbol{\cdot}N$ (which is actually a theorem), is taken to be pathwise ($\omega$-by-$\omega$) Lebesgue-Stieltjes integral with respect to the finite variance process which is in this case the quadratic covariation defined as $$ \langle M, N \rangle := \frac{1}{4}(\langle M+N \rangle - \langle M-N \rangle). $$
Your problems deal with the stochastic integral with respect to locally square-integrable martingale, please refer to S. N. Cohen and R. J. Elliott, Stochastic Calculus and Applications, 2nd ed.(2015), Th.12.2.1, p.264.
If you concern to stochastic integral with respect to locally continuous martingale only, please refer to D. Revuz, M. Yor, Continuous Martingales and Brownian Motion, 3rd ed. Springer, 2005, Th.2.2, p.137.
For more general semimartingale case, please refer to J. Jacod and A. N. Shiryayev, Limit Theory for Stochastic Processes, 2ed. Springer, 2003, Th.I.4.40, p.68.