Here is my solution
I bet you are preparing for indian statistical institute exam. (Im also preparing so best of luck)
First of all notice that there are 2i integers whose nearest integer to square root is i.It can be seen by taking a few examples.
So now write down a few terms $$S=\frac{2^1+2^{-1}}{2^1}+\frac{2^1+2^{-1}}{2^2}+\frac{2^{2}+2^{-2}}{2^3} \text{so on}$$

Now consider the sequence $1,3,7,...$ The nth term of this sequence can be written as $n^2-n+1$ You can now convert the sum as $$\sum_{1}^{\infty} \frac{2^i+2^{-i}}{2^{i^2-i+1}}[1/2+1/2^2+...\text{2i terms}]$$ which after simplification van be shown to telescope yielding $3$ as answer.It can be seen from the attached picture.