How to find the sum $1+\frac{1}{2}-\frac{1}{4}-\frac{1}{5}+\frac{1}{7}+\frac{1}{8}-\frac{1}{10}-\frac{1}{11}+\cdots =\ ?$

The key observation, which will be exploited below in computing the series $$ S=\sum_{n=1}^\infty\frac{\sigma_n}{n}, $$ where $\sigma_n$ is repeating sequence of $(1,1,0,-1,-1,0)$, is that $$ \sigma_n=\frac{2}{\sqrt3}\sin\frac{\pi n}{3}. $$ It follows: $$ S=\frac{2}{\sqrt3}S',\text{ with } S'=\sum_{n=1}^\infty\frac{\sin\frac{\pi n}{3}}{n}.\tag{1} $$ It appears to be simpler to compute directly $S'$. Two approaches to perform this are given below.


The first way, suggested in question, exploits the Fourier series of the even periodic function: $$ \phi(x)=\begin{cases} 0& -1<x<1\\ 1& -3<x<-1\text{ or } 1<x<3 \end{cases};\quad\phi(x+6)=\phi(x), $$ which is: $$ \phi(x)=\frac{2}{3}-\sum_{n=1}^\infty\frac{2\sin\frac{\pi n}{3}}{\pi n}\cos\frac{\pi n x}{3}.\tag{2} $$ Substituting in (2) $x=0$ one obtains: $$ 0=\phi(0)=\frac{2}{3}-\sum_{n=1}^\infty\frac{2\sin\frac{\pi n}{3}}{\pi n}= \frac{2}{3}-\frac{2}{\pi}S'\Rightarrow S'=\frac{\pi}{3}. $$


The second way is more direct as it does not rely on a foreknowledge of an appropriate function for Fourier series. Observe that for $|x|<1$: $$ \sum_{n=0}^\infty{x^n\sin\frac{\pi n}{3}}=\frac{1}{2i}\left(\frac{1}{1-xe^{\frac{\pi i}{3}}}-\frac{1}{1-xe^{-\frac{\pi i}{3}}}\right) =\frac{x\sin\frac{\pi}{3}}{1-2x\cos\frac{\pi}{3}+x^2}=\frac{\sqrt{3}}{2}\frac{x}{1-x+x^2}. $$

Thus, $$ S'=\sum_{n=1}^\infty\frac{\sin\frac{\pi n}{3}}{n}=\sum_{n=1}^\infty\sin\frac{\pi n}{3}\int_0^1 x^{n-1}dx=\frac{\sqrt3}{2}\int_0^1\frac{dx}{1-x+x^2}=\frac{\pi}{3}. $$


Finally the sum in question is computed using (1) as: $$ S=\frac{2}{\sqrt3}S'=\frac{2\pi}{3\sqrt3}. $$


In this answer, it is shown that $$ \sum_{k=-\infty}^\infty\frac{(-1)^k}{z+k}=\pi\csc(\pi z) $$ Therefore, $$ \begin{align} \sum_{k=0}^\infty(-1)^k\left(\frac1{3k+1}+\frac1{3k+2}\right) &=\sum_{k=0}^\infty(-1)^k\left(\frac1{3k+1}-\frac1{-3(k+1)+1}\right)\\ &=\sum_{k=0}^\infty\left(\frac{(-1)^k}{3k+1}+\frac{(-1)^{-k-1}}{3(-k-1)+1}\right)\\ &=\sum_{k=-\infty}^\infty\frac{(-1)^k}{3k+1}\\ &=\frac13\sum_{k=-\infty}^\infty\frac{(-1)^k}{k+\frac13}\\ &=\frac\pi3\csc\left(\frac\pi3\right)\\[6pt] &=\frac{2\pi}{3\sqrt3} \end{align} $$