TL;DR: I've made something work (again) but in the process I used something which makes no sense - I wonder why it all works in the end. Please explain it to me or disprove my findings.
Let's define an operator $\circledast$ in this way: $x \circledast y = \frac{x+y}{1+xy}$
I want to find $$((2\circledast3)\circledast4)\circledast\cdots\circledast n, \;n \ge 3$$
My Approach
First thing to notice is that: $(x \circledast y) \circledast z = x \circledast (y \circledast z)$ so it doesn't make any difference which order are we applying it and so we can remove all the parenthesis and read it as say "left to right".
Now remembering that $\tanh(x+y)=\frac{\tanh x+\tanh y}{1+\tanh x\cdot \tanh y}$ we can see that $\tanh(\tanh^{-1}x+\tanh^{-1}y)=\frac{x+y}{1+xy} = x \circledast y$. Therefore we can rewrite the expression we want as $S = \tanh(\tanh^{-1}2+\tanh^{-1}3+...+\tanh^{-1}n)$, so $$\tanh^{-1}S = \sum_{k=2}^n\tanh^{-1}k$$
"So far so good" - I would've said, but the issue is that inverse hyperbolic tangent has only domain $(-1, 1)$ over reals. But - let's roll with it, the "why it works" is part of the question.
From here we use the logarithmic form: $\tanh^{-1}x=\frac{1}{2}\ln\frac{1+x}{1-x}$ - again, ignoring the glaring issues with the domain. We get: $$\frac{1}{2}\ln\left(\frac{1+S}{1-S}\right) = \frac{1}{2}\sum_{k=2}^n\ln\left(\frac{1+k}{1-k}\right)=\frac{1}{2}\ln\left(\prod_{k=2}^n\frac{1+k}{1-k}\right)$$
Here's another "red flag" - using the logarithm property of sum to product on something that potentially doesn't exist - or even if it does, it is complex, and if I understand correctly, complex version of $\ln$ is $\mathrm{Log}$ which is multivalued so it's not right to claim $\ln(ab)=\ln(a)+\ln(b)$ .
Finally, we notice that if we flip the sign of the denominator we will end up with a telescoping product on the fraction shifted by 2 on the numerator to the right. Hence we end up with this: $$\frac{1}{2}\ln\left(\frac{1+S}{1-S}\right) = \frac{1}{2}\ln\left(\prod_{k=2}^n\frac{1+k}{1-k}\right) = \frac{1}{2}\ln\left((-1)^{n-1}\frac{n(n+1)}{2}\right)$$
We have $(-1)^{n-1}$ because there will be in total $n-1$ members (we start at $2$ and end at $n$). And now.. you guessed it. We got $\frac{1}{2}$ on both sides, we got $\ln$ on both sides - let's "cancel" them (another "red flag" here). If we do so we end up with $\frac{1+S}{1-S}=(-1)^{n-1}\frac{n(n+1)}{2}$ thus $$S=\frac{(-1)^{n-1}(n^2+n)-2}{(-1)^{n-1}(n^2+n)+2}$$
which is not only well-defined, but also is a correct expression for $S$ (it works for any $n$)
Question is - why does this work despite operating on things which are not well-defined? Or am I wrong and the $\tanh^{-1}x$ is well-defined outside of $(-1,1)$? (as well as $\ln$ and its properties over complex numbers)?
EDIT:
There's a proposed fix to the solution, courtesy of @Tortar. He has a great observation that $x \circledast y = \frac{1}{x} \circledast \frac{1}{y}$ and therefore we can avoid problematic domain issues if we rewrite $S = \frac{1}{2} \circledast \frac{1}{3} \circledast ... \circledast \frac{1}{n}$ . This, however, still has issues
- First, it doesn't explain why the original "solution" works. It all makes sense if I would apply this transformation before using $\tanh^{-1}$ but I do not, hence the question still stands
- More importantly - and this is why I decided to add this to the body of the question itself - this will lead to an incorrect result. That is because on the logarithms step we will get all valid $\ln\left(\frac{1+\frac{1}{k}}{1-\frac{1}{k}}\right) = \ln\left(\frac{k+1}{k-1}\right)$ which means that when we will combine the fractions together and remove repeating terms from it we end up losing $(-1)^{n-1}$ as there's nothing to negate. This will lead to the final expression for $S$ being invalid for all even $n$. Therefore while this relation establishes a link between the "wrong" way I do it and the "safe" way to do it, it looks like it's not as simple as just replacing $n$ with $\frac{1}{n}$ and something is still amiss.
The proof is perfectly valid as is. Since the issue seems to be a general discomfort with complex numbers and multivalued functions, I'll start by addressing that. (In what follows, all logarithms are with base $e$. The only difference between ln and log as used below is that the notation $\ln x$ is reserved for the ordinary real-valued logarithm for $x>0$.)
When we write equations like $\log(ab) = \log a + \log b$ for the multi-valued complex logarithm, it means that every value of the left side is one of the values of the right side, and vice versa. To put it another way, it means that the set of values of the LHS equals the set of values of the RHS.
The trouble only starts if we tried to choose one of the multiple values to be the principal value. For example, using the usual choice of $\operatorname{Log} z = \ln|z| + i \operatorname{Arg}(z)$ with $\operatorname{Arg}(z)$ in the interval $(-\pi, \pi]$, then $\operatorname{Log}(ab)$ is not always equal to $\operatorname{Log} a + \operatorname{Log} b$. For example, with $a = -2$ and $b = -3$, we have: $$ \operatorname{Log} a + \operatorname{Log} b = (\ln 2 + \pi i) + (\ln 3 + \pi i) = \ln 6 + 2 \pi i \ne \operatorname{Log}(6) $$ But if we don't try to single out a principal value, then nothing bad happens. In the multi-valued sense, $\log(-2)$ is $\ln 2 + (2m + 1)\pi i$ for any integer $m$, $\log(-3)$ is $\ln 3 + (2n + 1)\pi i$ for any integer $n$, and $\log(6)$ is $\ln 6 + 2k \pi i$ for any integer $k$. Every value of $\log(-2) + \log(-3)$ is one of the values of $\log(6)$, and vice versa. So, in an appropriate sense, the equation $\log(ab) = \log a + \log b$ remains valid.
Equations like $e^{\log a} = a$ are also still valid. Note that $\log a$ is multi-valued, but $e^{\log a}$ nevertheless has only one possible value.
Returning to the specifics of the question, $\tanh^{-1} x = \frac{1}{2} \log\frac{1+x}{1-x}$ is indeed a valid definition for all $x \ne \pm 1$, not just for $-1 < x < 1$. It still satisfies the identity $$ \tanh(\tanh^{-1} x + \tanh^{-1} y) = \frac{x+y}{1+xy}. $$ Now we are thinking of it as complex and multi-valued, and all the intermediate steps of the proof involve multi-valued expressions; there is nothing wrong with that. Near the end we obtain the equation $$ \frac{1}{2}\log\left(\frac{1+S}{1-S}\right) = \frac{1}{2}\log\left((-1)^{n-1}\frac{n(n+1)}{2}\right) $$ and there is no problem concluding that $\frac{1+S}{1-S} = (-1)^{n-1}\frac{n(n+1)}{2}$, because $\log x = \log y$ can only be true if $x = y$.