Notation with covariant/contravariant derivative with product rule I have a question that should be rather simple, but i simply can not find enough information about it. I have searched and found a lot of related material, but not exactly like my problem.
I am trying to do a basic derivation of the Klein-Gordon equation from the lagrangian density: $\mathcal{L}(\phi)=-\frac{1}{2}(\partial_{\mu}\phi\partial^{\mu}\phi+m^2\phi^2)$ this I put into the EL-equation and that works fine except for one small part. The thing that confuses me is the notation, and I cant seem to find that much about it in my textbooks (Peskin & Schroeder and Srednicki). They do it in a line or two, and i am trying to do a lot more intermediate steps:
I get stuck on this bit of the derivation:
$\frac{\partial}{\partial(\partial_{\mu}\phi)}[\partial_{\mu}\phi\partial^{\mu}\phi]$
I know that it should give me $(2\partial^{\mu}\phi)$ but i can not see exactly why or how. I have found that $\partial_{\mu}\partial^{\mu} \equiv \partial^{2} \equiv \Box^{2} = \frac{\partial^{2}}{\partial t^{2}}-\nabla^{2}$
and i feel like i am almost about to get it, but i still can not understand the notation. Would it be an idea to lower or raise on of the indices with a metric tensor?
For the sake of it, i have included all my equations underneath, but it is only the line mentioned above that i get stuck on.
$\frac{\partial}{\partial \phi}[-\frac{1}{2}(\partial_{\mu}\phi\partial^{\mu}\phi+m^2\phi^2)]-\partial_{\mu}\frac{\partial}{\partial(\partial_{\mu}\phi)}[-\frac{1}{2}(\partial_{\mu}\phi\partial^{\mu}\phi+m^2\phi^2)]$
$0 - m^2\phi - \partial_{\mu} \frac{\partial}{\partial(\partial_{\mu}\phi)}[-\frac{1}{2}\partial_{\mu}\phi\partial^{\mu}\phi] - 0$
$\frac{1}{2}\partial_{\mu}\frac{\partial}{\partial(\partial_{\mu}\phi)}[\partial_{\mu}\phi\partial^{\mu}\phi]-m^2\phi$
$\frac{1}{2}\partial_{\mu}(2\partial^{\mu}\phi)-m^2\phi$
$\partial_{\mu}\partial^{\mu}\phi-m^2\phi$
$(\partial_{\mu}\partial^{\mu}-m^2)\phi$
 A: Lets look at what exactly we mean with: $\partial_\mu\frac{\partial}{\partial(\partial_\mu\phi)}(\partial_\mu\phi\partial^\mu\phi)$ for that lets write the sums out:
\begin{align}
\partial_\mu\frac{\partial}{\partial(\partial_\mu\phi)}(\partial_\mu\phi\partial^\mu\phi)&=\left[\partial_0\frac{\partial}{\partial(\partial_0\phi)}+\sum_{i=1}^3\partial_i\frac{\partial}{\partial(\partial_i\phi)}\right]\left[(\partial_0\phi)(\partial^0\phi)+\sum_{j=1}^3(\partial_j\phi)(\partial^j\phi)\right]\\
&=\left[\partial_0\frac{\partial}{\partial(\partial_0\phi)}+\sum_{i=1}^3\partial_i\frac{\partial}{\partial(\partial_i\phi)}\right]\left[\pm(\partial_0\phi)(\partial_0\phi)\mp\sum_{i=j}^3(\partial_j\phi)(\partial_j\phi)\right]\\
&=\pm2\partial_0(\partial_0\phi)\mp2\sum_{i=1}^3\partial_i(\partial_i\phi)\\
&=2\partial_0(\partial^0\phi)+2\sum_{i=1}^3\partial_i(\partial^i\phi)\\
&=2\partial_\mu\partial^\mu\phi
\end{align}
The upper sign in the $\pm/\mp$ terms corresponds to the timelike-convention $(+---)$ and the lower sign to the spacelike-convention $(-+++)$ for the metric. 
The partial derivatives are only not-vanishing for $i=j$. The factor 2 comes from product rule or chain rule if you write $(\partial_\mu\phi)(\partial_\mu\phi)=(\partial_\mu\phi)^2$. The result in this compact form does not depend on the metric used: the  d'Alembert operator however does: 
\begin{align}
\partial_\mu\partial^\mu&=\partial_0\partial^0+\partial_i\partial^i\\
&=\pm\partial_0\partial_0\mp\partial_i\partial_i\\
&=\pm \frac{\partial^2}{\partial t^2}\mp\nabla^2.
\end{align}
OP seems to use the $(+---)$ convention judging from his d'Alembert operator. So 
$$\partial_\mu\frac{\partial}{\partial(\partial_\mu\phi)}(\partial_\mu\phi\partial^\mu\phi)=2(\frac{\partial^2}{\partial t^2}-\nabla^2)\phi$$
 and for the Euler-Lagrange equation using OP's Lagrange density follows:
\begin{align}0&=\frac{\partial}{\partial\phi}(-\frac 12\partial_\mu\phi\partial^\mu\phi-\frac 12 m^2 \phi^2)-\partial_\mu\frac{\partial}{\partial(\partial_\mu\phi)}(-\frac 12\partial_\mu\phi\partial^\mu\phi-\frac 12 m^2 \phi^2)\\
&=-m^2\phi +(\frac{\partial^2}{\partial t^2}-\nabla^2)\phi\\
0&=(\frac{\partial^2}{\partial t^2}-\nabla^2-m^2)\phi.
\end{align}
Which is NOT the Klein-Gordon (KG) equation because it is impossible to derive the KG equation with the given Lagrange density. The correct Lagrange density is $$\mathcal{L}_{KG}=\frac 1 2 (\partial_\mu \phi)(\partial^\mu \phi)-m^2 \phi^2.$$ With $\mathcal{L}_{KG}$ one can derive the KG equation with proper signs:
$$0=(\frac{\partial^2}{\partial t^2}-\nabla^2+m^2)\phi.$$ Sorry for not catching the fact that the Lagrange density is wrong sooner. A side note on that: OP mentioned Peskin & Schroeder they use the notation/convention $(\partial_\mu\phi)^2\equiv(\partial_\mu\phi)(\partial^\mu\phi)$ which could be the reason for the confusion.
