Evaluate $\lim_{n\to \infty} \sum_{r=1}^n \frac {1}{2^r}\tan \left(\frac {1}{2^r}\right)$

Evaluate $$\lim_{n\to \infty} \sum_{r=1}^n \frac {1}{2^r}\tan \left(\frac {1}{2^r}\right)$$

I tried to create a telescoping sum but I couldn't. The last step I could reach was turning the limit into $$\lim_{n\to \infty} \sum_{r=1}^n \left(\frac {1}{2^r(1-\tan (2^{-r+1})} -\frac {1}{2^r(1+\tan (2^{-r+1})}\right)$$

But couldn't proceed further. Also I thought about Riemann sums but it was a pure dead end. Any help would be greatly appreciated

Solution 1. By the sine double-angle formula,

$$\sin x = 2^n \sin(2^{-n}x) \prod_{k=1}^{n} \cos(2^{-k}x).$$

Now log-differentiating both sides gives

$$\cot x = \frac{1}{2^n}\cot\left(\frac{x}{2^n}\right) - \sum_{k=1}^{n} \frac{1}{2^k}\tan\left(\frac{x}{2^k}\right).$$

Taking $n\to\infty$ and simplifying gives

$$\sum_{k=1}^{\infty} \frac{1}{2^k}\tan\left(\frac{x}{2^k}\right) = \frac{1}{x} - \cot x.$$

Solution 2. The above computation suggests the type of telescoping that we have to create. Indeed, by the tangent double-angle formula

$$\frac{1}{2}\cot\left(\frac{x}{2}\right) - \frac{1}{2}\tan\left(\frac{x}{2}\right) = \frac{1-\tan^2(x/2)}{2\tan(x/2)} = \cot x$$

and hence

\begin{align*} \sum_{k=1}^{n} \frac{1}{2^k}\tan\left(\frac{x}{2^k}\right) &= \sum_{k=1}^{n} \left( \frac{1}{2^k}\cot\left(\frac{x}{2^k}\right) - \frac{1}{2^{k-1}}\cot\left(\frac{x}{2^{k-1}}\right) \right) \\ &= \frac{1}{2^n}\cot\left(\frac{x}{2^n}\right) - \cot x. \end{align*}

Taking $n\to\infty$ gives the same answer.