Evaluation of given limit when $f(x)=\sum^{n}_{k=1} \frac{1}{\sin 2^kx}$ and $g(x)=f(x)+\frac{1}{\tan 2^nx}$

HINT:

$$\dfrac1{\sin2y}+\dfrac1{\tan2y}=\dfrac{2\cos^2y-1+1}{2\sin y\cos y}=\dfrac1{\tan y}$$

Put $2y=2^nx$ and recognize the pattern to find $$\dfrac1{\tan2^nx}+\sum_{k=1}^n\dfrac1{\sin2^kx}=\dfrac1{\tan x}$$


Basically, what you have to show (lab bhattacharjee gave you the hint while I was typing) is that $$f(x)=\cot (x)-\cot \left(2^n x\right)$$ which makes $$g(x)=\cot (x)$$ Now consider $$A=\cos(x)^{\cot(x)}\qquad , \qquad B=\bigg(\frac{1}{\cos (x)} \bigg)^{\frac{1}{\sin (x)}} $$ So $$\log(A)=\cot(x) \log(\cos(x))\qquad , \qquad \log(B)=-\frac{1}{\sin (x)}\log(\cos(x))$$ and use Taylor series to get $$\log(A)=-\frac{x}{2}+\frac{x^3}{12}+O\left(x^4\right)$$ $$\log(B)=\frac{x}{2}+\frac{x^3}{6}+O\left(x^4\right)$$ Now, using $y=e^{\log(y)}$ and Taylor again $$A=1-\frac{x}{2}+\frac{x^2}{8}+\frac{x^3}{16}+O\left(x^4\right)$$ $$B=1+\frac{x}{2}+\frac{x^2}{8}+\frac{3 x^3}{16}+O\left(x^4\right)$$ $$A+B=2+\frac{x^2}{4}+\frac{x^3}{4}+O\left(x^4\right)$$ which shows the limit and how it is approached.

For illustration puroposes, let us compute the value of the expression for $x=\frac \pi 4$. The exact value is $$\frac{1}{\sqrt{2}}+2^{\frac{1}{\sqrt{2}}}\approx 2.33963$$ while the above formula gives $$2+\frac{\pi ^2}{64}+\frac{\pi ^3}{256}\approx 2.27533$$ and we are far away from $x=0$.