This is the special case $q=3$ of a formula $$ \qquad\qquad \sum_{n=1}^\infty \frac{2^n}{q^{2^{n-1}}+1} = \frac{2}{q-1} \qquad\qquad(*) $$ which holds for all $q$ such that the sum converges, i.e. such that $|q|>1$. This follows from the identity $$ \frac{1}{x-1} - \frac{2}{x^2-1} = \frac{1}{x+1}. $$ Substitute $q^{2^{n-1}}$ for $x$, multiply by $2^n$, and sum from $n=1$ to $n=N$ to obtain the telescoping series $$ \frac{2}{q-1} - \frac{2^{N+1}}{q^{2^N}-1} = \sum_{n=1}^N \left( \frac{2^n}{q^{2^{n-1}}-1} - \frac{2^{n+1}}{q^{2^n}-1} \right) = \sum_{n=1}^N \frac{2^{n-1}} {q^{2^n} + 1}. $$ Taking the limit as $N \to \infty$ yields the claimed formula $(*)$.