Starting with the lagrangian density $$L=\frac{1}{2}((\partial_\lambda\phi)(\partial^\lambda \phi) + \mu^2\phi^2),$$ Chen and Li yield the Klein Gordon equation $$(\partial_\lambda \partial^\lambda + \mu^2)\phi=0$$ using Euler-Lagrange formalism.
Looking at the first term, we have $$\partial_{\lambda}\frac{\delta L}{\delta\left(\partial_{\lambda}\phi\right)} = \partial_\lambda \frac{1}{2}\frac{\delta((\partial_\lambda\phi)(\partial^\lambda \phi))}{\delta(\partial_\lambda \phi)}$$
And then I guess by assuming product rule we get $\partial_\lambda \partial^\lambda\phi$. I think I'm missing some understanding in definitions. Shouldn't the covariant and contravariant tensors be formally different objects, so that the partial derivative with respect to $\partial_\lambda \phi$ would consider $\partial^\lambda \phi$ as a constant?
I guess not, but I don't understand what the formal treatment of the partial derivative is, when we differentiate with respect to a tensor of one type and inspect a tensor of the other type.
For example, if we have $$f=a\cdot x_\mu$$for some scalar constant $a$, does $\delta f/\delta x^\mu = a$?
Specifically, the question also holds for the conjugate momentum $$\pi\left(x\right)=\frac{\delta L}{\delta\left(\partial_{0}\phi\right)}=?=\partial_0\phi$$
And how does this partial derivative generalize to a tensor of rank $(n,m)$?