The question is to calculate the sum of series. The series is $$\sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{2n-1}.$$
My attempt: Consider the series $$\sum_{n=1}^{\infty}\frac{x^{2n-1}}{2n-1},$$ take the derivative term-by-term, I have $$\sum_{n=1}^\infty x^{2n-2}=\frac{1}{1-x^2}.$$ Integrate on both sides, $$\sum_{n=1}^{\infty}\frac{x^{2n-1}}{2n-1}=\int \frac{1}{1-x^2}~\mathrm dx=\frac12(\ln(1+x)-\ln(1-x)).$$ Therefore, $$\sum_{n=1}^{\infty}\frac{x^{2n-2}}{2n-1}=\frac1{2x}(\ln(1+x)-\ln(1-x)).$$ Substitute $x=i$, I reach $$\sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{2n-1}=\frac1{2i}(\ln(1+i)-\ln(1-i)).$$
Can I substitute $x=i$ into last equation? Is this valid in the convergent domain? Having seen the right answer,I presume I think more about it.

The radius of convergence $$\arctan z=\sum_{n=0}^{\infty}\frac{(-1)^n z^{2n+1}}{2n+1}$$ is $|z|\le 1, z\ne i,-i$, so it is valid in your case.
Actually you have written the logarithm form of $\arctan$ fuction on $\Bbb C$: $$\arctan z =\frac i2(\ln(1-iz)-\ln(1+iz))$$ so $$\sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{2n-1}=\frac i2(\ln(1-i\cdot{\color{red}1})-\ln(1+i\cdot{\color{red}1}))=\arctan({\color{red}1})=\frac\pi 4.$$