# Conditions for changing the order of integration for contour integral.

I assume an integral $$I=\int_0^\infty f(x)g(x)\mathrm dx \tag{1}$$ where the function $f(x)$ can be represented as a contour integral in complex plane: $$f(x)=\oint_\Delta \frac{h(x,s)}{s^n(1-s)}\mathrm ds\tag{2}$$ with $h(x,s)$ having no poles other then $s=0$ and the contour $\Delta$ is any contour (usually a circle with raduis $0<r<1$) which encircles the origin $s=0$.
So changing the order of integration I get $$I=\int_0^\infty \left(\oint_\Delta \frac{h(x,s)}{s^n(1-s)}\mathrm ds \right) g(x)\mathrm dx=\oint_\Delta \frac{1}{s^n(1-s)}\left(\int_0^\infty h(x,s) g(x)\mathrm dx\right)\mathrm ds \tag{1*}$$ Let's assume that the inner integral can be evaluated too: $I_{\text{inner}}(s)=\int_0^\infty h(x,s) g(x)\mathrm dx$ but in addition to the poles at $s=0$ and $s=1$ it has $2$ new poles at $s=\alpha_1$ and $s=\alpha_2$ which are inside the unit circle and hence can be possibly inside (both or each of them individually) or outside the contour of integration $\Delta$.
Let's in addition assume that the resultant integral $I=\oint_\Delta \frac{1}{s^n(1-s)}I_{\text{inner}}(s)\mathrm ds$ can be evaluated (and gives four different answers $I_{\alpha_1}, I_{\alpha_2}, I_{\text{none}}, I_{\alpha_1\,\alpha_2}$) for all the cases: $\alpha_1$ or $\alpha_2$ is inside $\Delta$; neither of them are inside $\Delta$ and both of them are there.
But which of them should I choose since $\Delta$ is an arbitrary contour?
So I'm tackled by the following questions:

1. How should I cope with new poles arising after evaluating $I_{\text{inner}}(s)$?
2. Should I choose $\Delta$ beforehand somehow keeping in mind the possibility of new poles?
3. What bothers me most is the step with interchanging the order of integration. What are the necessary and sufficient conditions for changing the order of a real and a contour integral?