Derivation of the elasticity of substitution of a general production function with labor-augmenting technological progress
You have that in  equilibrium each factor is paid its marginal product, so 
$$\tag1\frac{w_i}{p_i}=B_if'(l_i)$$ and $$\tag2\frac{r_i}{p_i}=f(l_i)-K_if'(l_i)\frac{B_iL_i}{K_i^2}=f(l_i)-l_if'(l_i)$$ so deviding (2) by (1) we have:

$$\tag3\frac{r_i}{w_i}=\frac{f(l_i)-l_if'(l_i)}{B_if'(l_i)}.$$

Take the derivative of $r_i/w_i$ with respect to $l_i$:
$$\tag4\frac{d(r_i/w_i)}{d(l_i)}=\frac{(f'(l_i)-(f'(l_i)+l_if''(l_i)))B_if'(l_i)-B_if''(l_i)(f(l_i)-l_if'(l_i))}{(B_if'(l_i))^2}=-\frac{f''(l_i)f(l_i)}{B_i(f'(l_i))^2}$$

Note that $l_i=\frac{B_i}{(K_i/L_i)}$ so 
$$\tag5\frac{d(l_i)}{d(K_i/L_i)}=-\frac{B_i}{(K_i/L_i)^2}=\frac{l_i}{(K_i/L_i)}.$$ Using the chain rule ans substituting (4) and (5) we have:
$$\frac{d(r_i/w_i)}{d(K_i/L_i)}=\frac{d(r_i/w_i)}{d(l_i)}\frac{d(l_i)}{d(K_i/L_i)}=\frac{l_if''(l_i)f(l_i)}{(K_i/L_i)B_i(f'(l_i))^2}$$ and by the inverse function theorem we get:
$$\tag 6\frac{d(K_i/L_i)}{d(r_i/w_i)}=\frac{(K_i/L_i)B_i(f'(l_i))^2}{l_if''(l_i)f(l_i)}$$

Finally by multiplying (3) and (6) and dividing  by  $(K_i/L_i)$ we conclude that 

$$\sigma_i=\frac{d(K_i/L_i)}{d(r_i/w_i)}\frac{r_i/w_i}{K_i/L_i}=\frac{(K_i/L_i)B_i(f'(l_i))^2}{l_if''(l_i)f(l_i)}\cdot\frac{f(l_i)-l_if'(l_i)}{(K_i/L_i)B_if'(l_i)}=\frac{f'(l_i)(f(l_i)-l_if'(l_i))}{l_if''(l_i)f(l_i)}=\frac{f(l_i)}{l_if''(l_i)}\left[1-\frac{l_if'(l_i)}{f(l_i)}\right]$$

as desired. $Q.E.D.$