MathJax is a fugly hack. And it becomes even fuglier when Markdown interferes with it.
MathJax scans through the entire page looking for text fragments enclosed in dollar signs, without any interspersed formatting markup, and then transforms them into mathematical notation. This works… acceptably (though it performs pretty poorly even then) when you author HTML directly, but less so when there is an intermediate preprocessing stage of Markdown. Which, on Stack Exchange, there is.
Let’s have a look at how your markup renders without MathJax:
$ (\mathcal L_r \eta){\mu_1...\mu_p}=(r+p)\eta{\mu_1...\mu_n} $
Markdown has no awareness of MathJax and its $
delimiters, whether the latter is enabled on a given site or not; $
is just a character like any other. So the later pair of underscore characters _
between the brackets is interpreted as italics formatting like usual. This becomes interspersed formatting markup that breaks up the string and makes it invisible to MathJax.
As a workaround, you can write _
as \_
, so that Markdown turns it back into _
in the rendered HTML without any formatting, which MathJax will in turn recognise and interpret as subscript. And do similarly with everything else Markdown may misinterpret: square brackets, asterisks…
As an alternative (but for display math) something I noticed is that you can also suppress Markdown interpretation by inserting an HTML <p>
(paragraph) tag at the beginning of the line:
<p> $$ (\mathcal L_r \eta)_{\mu_1...\mu_p}=(r+p)\eta_{\mu_1...\mu_n} $$
$$ (\mathcal L_r \eta)_{\mu_1...\mu_p}=(r+p)\eta_{\mu_1...\mu_n} $$
Of course the real fix would be to make the Markdown renderer aware of MathJax. Make it recognise the $
and $$
delimiters and refrain from interpreting anything between them as formatting markup (and probably wrap it in tags MathJax could look for instead of scraping everything), much like it does with `
and ``
. At the very least.