Guidelines for choosing integrand to get a sum. 
The idea was to find:
$$\sum_{n=1}^{\infty} \frac{\coth(n\pi)}{n^3}$$
As you see in the solution, they conveniently choose a $f(z)$ they chose:
$$f(z) = \frac{\pi \cot(\pi z)\coth(\pi z)}{z^3}$$
That eventually led to their goal.
What are the guidelines for choosing such $f(z)$? 

First of all, i'm not an expert in this kind of problems, but i think you should have always three things in mind:
1.) Some of the poles of your generating function should render the sum that you are looking for
2.) The residues of all the other poles should be:
2a) As Easily obtainable as possible and 
 2b) be of finite number, or generating a sum which is easier to calculate then   original one.
3.) You have to make sure that you can close your contour of integration in an appropriate manner
I hope this helps...
