We know that the residue of a function $f(z)$ at a simple pole $z_0$ can be calculated by:
$$\lim_{z \rightarrow z_0}[(z-z_0)f(z)] \tag{1}$$
However while reading K.F Riley Mathematical Methods for Physicist, question 24.15. Given the function:
$$f(z) = \frac{\exp(imz)}{(z+i)(z-i)(2z+i)(2z-i)}$$
I notice that the solutions calculated the residues as
$$\lim_{z \rightarrow \frac{i}{2}} \biggl[(2z-i)\frac{\exp(imz)}{(z+i)(z-i)(2z+i)(2z-i)} \biggr] = \frac{-2ie^{-m/2}}{3} \tag{2}$$
rather than
$$\lim_{z \rightarrow \frac{i}{2}}\biggl[(z - \frac{i}{2})\frac{\exp(imz)}{4(z+i)(z-i)(z+ \frac{i}{2})(z-\frac{i}{2})} \biggr] = \frac{-ie^{-m/2}}{3} \tag{3}$$
I know $(3)$ is the correct solution rather than $(2)$ because it follows the form given by $(1)$. But I cannot wrap my head around why $(2)$ is incorrect since both $(2)$ and $(3)$ are essentially doing the same thing. Is there a reason why?
Since you ask about the "mechanics" of the calculation:
Now, as in your case, if you take instead any $cz-d=c(z-\frac dc)=c(z-z_0)$ $(c\neq 0)$, the limit would be $$\lim_{z\to z_0}((cz-d)f(z)) = c\lim_{z\to z_0}((z-z_0)f(z))$$ $$ = c\lim_{z\to z_0}(a_{-1}+(z-z_0)g(z)) = ca_{-1}$$
Note, that in your special case
$$f(z) = \frac{\exp(imz)}{(z+i)(z-i)\color{blue}{(2z+i)(2z-i)}} = \frac{\exp(imz)}{\color{blue}{4}(z+i)(z-i)\color{blue}{(z+\frac i2)(z-\frac i2)}}$$
So, in way $(2)$ of calculating the residue you cancel out the factor $(2z-i)$ but at the same time you multiply the residue by $2$.