To find the Laurent series of function $f(a)$ at point $a=0$ $$ f(a)=\int^1_0 \frac{d x}{x^2+a^2} $$ one can first do the integral $$ f(a)=\frac{1}{a}\arctan(1/a) $$ then expand $\arctan(1/a)$ and obtain $$ f(a)\approx \frac{\pi}{2a}-1+O(a^2). $$ However if one expands the integrand before integration, one would get divergent integral.
My question is: is there any method helping us expand the function $f(a)$ before performing the integral? The motivation arises from more complicated cases, when the functions can not be integrated out analytically.
==========================================
Updated: I think I find the solution to this integral. When I expand the function $f(a)$, I have to expand all the integral, not only the integrand $$ \frac{1}{x^2+a^2}\approx \frac{1}{x^2}+O(a^2) $$ which means that the upper limit of integral has also to be changed, i.e. $$ f(a)\approx \int^1_a d x\left(\frac{1}{x^2}+O(a^2)\right) $$ this gives us $$ f(a)\approx \frac{13}{15 a}-1+O(a^2) $$ Except the coefficient of $a^{-1}$, all the other orders are consistent.
Step 1: Expanding the integrand with respect to $a$ round $a\sim 0$ $$ \frac{1}{x^2+a^2}=\sum_{n=0}^\infty (-1)^n\frac{ a^{2n}}{x^{2n+2}} $$ Step 2: Deforming the integral $$ \int^\infty_0 dx \to \int^\infty_{\epsilon a} dx $$ Step 3: Performing the integral $$ \sum_{n=0}^\infty (-1)^n a^{2n}\int^\infty_{\epsilon a} \frac{dx}{x^{2n+2}} =\sum_{n=0}^\infty (-1)^n \frac{a^{2n}}{2n+1} +\frac{1}{a}\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)\epsilon^{2n+1}} $$ The second term is nothing else but ${\rm arccot}(\epsilon)/a$.
Step 4: Taking the limit $\epsilon \to 0$
$${\rm arccot}(\epsilon)/a\to \pi/(2a)$$ and $$f(a) = \frac{\pi}{2a}+\sum_{n=0}^\infty (-1)^n \frac{a^{2n}}{2n+1}$$