Calculation on Riemannian manifolds I am learning the variational calculation of Yang Mills functional, but I can't understand 2 steps in the following calculation:

Given a variation of the connection $A$ in local coordinates: $A\to A+\delta A$. Recall that $$F_{jk}=-(\partial_j A_k-\partial_k A_j+A_jA_k-A_kA_j)$$
So, \begin{equation}\begin{split}\delta F_{jk}=&-(\partial_j\delta A_k-\partial_k\delta A_j+\delta A_j\cdot A_k+A_j\delta A_k-\delta A_k\cdot A_j-A_k\delta A_j)=\\=&-(\partial_j\delta A_k+A_j\delta A_k-\delta A_k\cdot A_j-(\partial_k\delta A_j+A_k\delta A_j-\delta A_j A_k)=\\=&-(\nabla_j\delta A_k-\nabla_k\delta A_j)\end{split}\end{equation}
Thus, let $I$ be the Yang-Mills functional of $F$, then
\begin{equation}
\begin{split}
\delta I=&\delta\int_X\left\langle F,F\right\rangle=2\int_X\left\langle\delta F,F\right\rangle=\\
=&2\int_X(\nabla_j\delta A_k-\nabla_k\delta A_j)g^{jl}g^{km}F_{ml}=\\
=&2\int_X-\delta A_k\cdot g^{km}\nabla^lF_{ml}+\delta A_j g^{jl}\nabla^mF_{ml}=\\
=&4\int_X\delta A_k\cdot g^{km}\nabla^lF_{lm}
\end{split}
\end{equation}

To begin with, I don't understand why $$2\int_X\left\langle\delta F,F\right\rangle=2\int_X(\nabla_j\delta A_k-\nabla_k\delta A_j)g^{jl}g^{km}F_{ml}$$ is true: it seems to me that since $F\in \Gamma(End(E)\otimes \bigwedge^2T^*M, M)$, a metric for $F$ should include both factors representing metric for $\bigwedge^2T^*M$ and factors representing metric for $End(E)$. I think $g^{jl}$ and $g^{km}$ are factors for metric of $\bigwedge^2 T^*M$, but where is the factors for the metric on $End(E)$?
Besides this, I also don't understand why $$2\int_X(\nabla_j\delta A_k-\nabla_k\delta A_j)g^{jl}g^{km}F_{ml}=2\int_X-\delta A_k\cdot g^{km}\nabla^lF_{ml}+\delta A_j g^{jl}\nabla^mF_{ml}.$$ There is a remark on my note that says this is due to integration by parts, but I only know integration by parts for integration on $\mathbb{R}^1$ and doesn't know what version of integration by parts should I use here. Besides this confusion on applying integration by parts, I also don't seem to understand the definition of $\nabla^m F_{ml}$.
Many thanks in advance!
 A: I assume you are interested in the case of a principal $G$-bundle for some semisimple compact Lie group $G$, typically $SU(n)$, or an associated vector bundle.
What one usually does is to fix an invariant inner product on $G$, the Killing form, which up to a sign is simply the trace. I agree with you that in the above computations there does not seem to be indication of the pairing on the Lie algebra, it is however possible that it is implied that all the expressions inside the integrals should be traced. Similarly, the volume form against which the expressions should be integrated is not indicated. It is probably safe to assume that it is the usual Riemannian volume form.
As for the integration by parts: the version you need is that, on a compact Riemannian manifold $(X,g)$, for any vector field $Y$
\begin{equation}
\int_X\mathrm{div}(Y)\,\mathrm{vol}_g=0
\end{equation}
where $\mathrm{div}(Y)=\nabla_iY^i$ is the divergence of $Y$. It is not immediately clear how to apply this to our situation. Notice that we have a covariant derivative (the Levi-Civita connection) on $TX$, and a different covariant derivative, $\nabla$, on $E$. Slightly abusing notation, we indicate again by $\nabla$ the connection induced by these two on $TX\otimes E$. Then we can compute
\begin{equation}
\int_X\mathrm{Tr}\left(\nabla_j\delta A_k\,F_{ml}\right)g^{jl}g^{km}\,\mathrm{vol}_g=\int_X\nabla_j\left[\mathrm{Tr}\left(\delta A_k\,F_{ml}\right)g^{jl}g^{km}\right]\mathrm{vol}_g-\int_X\mathrm{Tr}\left(\delta A_k\,\nabla_jF_{ml}\right)g^{jl}g^{km}\,\mathrm{vol}_g
\end{equation}
using that the connection preserves the metric $g$. Notice that the first term on the right-hand side is just $\int_X\mathrm{div}(Y)\,\mathrm{vol}_g$ for the vector field
\begin{equation}
Y=\mathrm{Tr}\left(\delta A_k\,F_{ml}\right)g^{jl}g^{km}\partial_j.
\end{equation}
Also, $\nabla^lF_{ml}$ is usually just shorthand for $\nabla_jF_{ml}g^{jl}$: you are raising an index using the metric tensor. Putting all together,
\begin{equation}
\int_X\mathrm{Tr}\left(\nabla_j\delta A_k\,F_{ml}\right)g^{jl}g^{km}\,\mathrm{vol}_g=-\int_X\mathrm{Tr}\left(\delta A_k\,\nabla^lF_{ml}\right)g^{km}\,\mathrm{vol}_g.
\end{equation}
The other term can be computed analogously, the only difference is the order of the indices.
