# How to choose a proper contour for a contour integral?

When analyzing real integrals with contour integrals, how does one choose a proper contour integral?

Many cases can be solved by integrating around the top half of a circle with radius of infinity and then integrating along the entire real line.

I understand how when integrating one would avoid the branch cuts, but how would one know to use a rectangle or a quarter of a circle as a contour?

-