Why in tensors is the identity $\int{A_{\nu}\partial_{\mu}}\partial^{\nu}A^{\mu} = \int A_{\mu}\partial^{\mu}\partial^{\nu}A_{\nu}$ valid I am trying to understand the  and there is a step in the Derivation of something and there is a step which I cannot understand.
Its basically a lack of understanding of tensors so any help would be appreciated:
I am unsure about this line $$\int{A_{\nu}\partial_{\mu}}\partial^{\nu}A^{\mu} = \int A_{\mu}\partial^{\mu}\partial^{\nu}A_{\nu}$$
$A_{\mu}$ is a real free vector by the way.
I thought it may have something to do with using the metric tensor and have tried the following
$$\int{A_{\nu}\partial_{\mu}}\partial^{\nu}A^{\mu} = \int A_{\nu}\partial^s g_{s \mu} \partial^{\nu}A^{\mu} = \int A_{\nu}\partial^s  \partial^{\nu}A_{s} = \int A_{\nu}\partial^\mu  \partial^{\nu}A_{\mu} $$
however
$$\int A_{\nu}\partial^\mu  \partial^{\nu}A_{\mu}  \neq  \int A_{\mu}\partial^{\mu}\partial^{\nu}A_{\nu}$$
Any help in understanding where I went wrong and how to get the first equation I stated woul be appreciated.
 A: Assuming that $A$ has continuous derivatives (or is a distribution), the partial derivatives commute, so
$$
A_\nu \partial_\mu \partial^\nu A^\mu
= A_\nu \partial^\nu \partial_\mu A^\mu
= (A_\nu \partial^\nu) (\partial_\mu A^\mu)
= \{ \mu \leftrightarrow \nu \}
= (A_\mu \partial^\mu) (\partial_\nu A^\nu)
\\
= \{ \text{see-saw rule} \}
= (A_\mu \partial^\mu) (\partial^\nu A_\nu)
= A_\mu \partial^\mu \partial^\nu A_\nu
.
$$
A: As far as I understand you initially operate in flat Minkowski space with $g_{\mu\nu}=g^{\mu\nu}=diag(1,-1,-1,-1)$
In this case $\partial_\mu=\frac{\partial}{\partial{x}^\mu}$
You have a summation over repeated indices: $\partial^\mu{A}_\mu=g^{\mu\lambda}\partial_\lambda{A}_\mu=\partial_\mu{A}^\mu=\partial_0A^0+\partial_1A^1+\partial_2A^2+\partial_3A^3=\partial_0A_0-\partial_1A_1-\partial_2A_2-\partial_3A_3$
Index $\mu$ here is a dumb index of summation- you may can write $\partial^\delta{A}_\delta$ instead.
Next, in Minkowski space $\partial_\mu\partial_\nu=\partial_\nu\partial_\mu$ (ordinary derivatives). Renaming you summation indices and swapping derivatives you get ${A_{\nu}\partial_{\mu}}\partial^{\nu}A^{\mu}={A_{\mu}\partial^{\mu}}\partial^{\nu}A_{\nu}$
In curved space we have to switch to covariant derivatives $\partial_\mu{A}^\nu\to{A}^\nu;\mu$. In general ${A}^\nu;\nu;\mu\neq{A}^\nu;\mu;\nu$
