Confused about developing a Taylor series of a function that implicates an integral
Note that
$$\cos t = -\sin\left(t-\frac{\pi}{2} \right) = \sum_{n=0}^\infty \frac{(-1)^{n+1}}{(2n+1)!}\left( t-\frac{\pi}{2}\right)^{2n+1}$$
Then by integration
\begin{align}f(x) &= \int^{x}_{\pi/2}\frac{1}{t-\pi/2} \sum_{n=0}^\infty \frac{(-1)^{n+1}}{(2n+1)!}\left( t-\frac{\pi}{2}\right)^{2n+1}\,dt\\&= \sum_{n=0}^\infty \frac{(-1)^{n+1}}{(2n+1)!}\int^{x}_{\pi/2}\left( t-\frac{\pi}{2}\right)^{2n}\,dt \\&= \sum_{n=0}^\infty \frac{(-1)^{n+1}}{(2n+1)!}\int^{x-\pi/2}_{0}t^{2n}\,dt \\&= \sum_{n=0}^\infty \frac{(-1)^{n+1}}{(2n+1)(2n+1)!}\left(x-\frac{\pi}{2} \right)^{2n+1} \end{align}
I think you are over-thinking this. A taylor series of a function f, by definition is $$f(x) = f(a) + f'(a)(x-a) + \frac{1}{2}f''(a)(x-a)^2 +...$$ Specifically, $f(a) = f(\pi/2)= \int_{\pi/2}^{\pi/2}\frac{\cos t}{t-\pi/2}dt=0$ because both bounds of integration are equal. Next we should use the second fundamental theorem of calculus that says if $f(x) = \int_c^{u(x)}g(t)dt$ then $f'(x) = g(u(x))\cdot u'(x)$. In out case, $$f'(x) = \frac{\cos (x)}{x-\pi/2}$$ If we plug in $\pi/2$ for $x$ we get $0/0$ so we take the limit and use LHopital's rule $$\lim_{x \rightarrow \pi/2}\frac{\cos (x)}{x-\pi/2}= \lim_{x \rightarrow \pi/2} \frac{-\sin(x)}{1}=-1.$$ Let's take a few more derivatives (hopefully a pattern emerges) $$f''(x) = \frac{-\sin(x)(x-\pi/2)-\cos(x)}{(x-\pi/2)^2}$$ Again, plugging in $\pi/2$ gets us $0/0$ so again we take the limit $$\lim_{x\rightarrow \pi/2}\frac{-\sin(x)(x-\pi/2)-\cos(x)}{(x-\pi/2)^2} = \lim_{x \rightarrow \pi/2} \frac{-\cos(x)(x-\pi/2) - \sin(x)+\sin(x)}{2(x-\pi/2)}=0$$ . I still don't see a pattern maybe one will emerge if we take more derivatives, in any case, every coefficient of the sequence is well defined and can be found analytically. So $$f(x)= 0 -1(x-\pi/2)+0 + O((x-\pi/2)^3)$$ I have a lingering suspicion that all the even terms are 0 but I will leave this as an exercise to the reader (translation: I don't feel like doing it). Hope I helped.