How can I transform $\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^k\sin(\pi rn)}$ into a modular form? Let
$$f_k(z)=\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^k\sin(\pi zn)}$$
be a family of holomorphic functions on the upper-half plane $\mathbb{H}=\{a+bi|b>0\}$ for each odd natural number $k$. These functions clearly satisfy the periodicity condition $f_k(z+2)=f_k(z)$, but more surprisingly they also satisfy the formula
\begin{equation}
z^{\frac{1-k}{2}}f_k(z)+z^{\frac{k-1}{2}}f_k\left(\frac{1}{z}\right)=\sum_{j=0}^{k+1}a_{k,j}z^{\frac{k+1}{2}-j}\tag{1}
\end{equation}
where $a_{k,j}$ are given by
\begin{equation}
a_{k,j}:=\frac{(-1)^{\frac{k+1}{2}}(2\pi)^k}{(k+1)!}{k+1\choose j}B_j\left(\frac{1}{2}\right)B_{k+1-j}\left(\frac{1}{2}\right)\tag{2}
\end{equation}
where $B_j(\cdot)$ are the Bernoulli polynomials. I discovered and proved this formula a year ago and didn't think much of it, but recently I have begun thinking about there recurrences in the context of modular/cusp forms and $L$-functions. More specifically, these two formulas seem quite similar to those of a cusp form of weight $1-k$ over the congruence subgroup $\Gamma(2)$. The match isn't perfect because of the extraneous polynomials that pop up on the LHS of (2), but it still makes one wonder.
Another piece of evidence that the functions $f_k(\cdot)$ are connected to modular forms is that they naturally induce $L$-functions in the same way that modular forms do. In this context I mean that if a modular form $g$ of weight $k$ has $q$-expantion $g(z)=\sum_{n}a_n n^{\frac{k-1}{2}}q^n$ then it induces the $L$-function $L(g,s)=\sum_{n}a_n n^{-s}$. The $L$-function attached to $f_k(z)$ is
\begin{align}
L(f_k,s)&=2i\frac{1-2^{1-\frac{k}{2}-s}}{1-2^{-\frac{k}{2}-s}}\zeta\left(s-\frac{k}{2}\right)\zeta\left(s+\frac{k}{2}\right)\\
&=2i\frac{1-2^{1-\frac{k}{2}-s}}{1-2^{-\frac{k}{2}-s}}\prod_{p}\frac{1}{1-\left(p^{\frac{k}{2}}+p^{-\frac{k}{2}}\right)p^{-s}+p^{-2s}}
\tag{3}\end{align}
Making $L(f_k,s)$ a degree 2 $L$-function with a critical line $\Re(s)=\frac{1}{2}$. $L(f_k,s)$ is not of the Selberg class of $L$-functions since there is no function $\gamma_k(s)$ such that $\Lambda_k(s):=\gamma_k(s)f_k(s)$ satisfies $\Lambda_k(1-s)=\Lambda_k(s)$.
I suspect that the fact that the $L$ function generated is "almost" of the Selberg class corresponds to the fact that $f_k(z)$ is "almost" a cusp form. My overall goal with connecting $f_k(z)$ to modular forms would be to learn something non-trivial about the cosecant function $\frac{1}{\sin(\pi zr)}$ or to use the fact that the vector space of cusp forms $S_k(\Gamma(2))$ is finite dimensional and has a simple basis to find a new way to compute
$$\sigma_k^{(o)}(n):=\sum_{\substack{d|n \\ d\equiv 1\mod{2}}}d^k$$
since the $q$-expantion of $f_k(z)$ is
$$f_k(z)=\sum_{n=1}^{\infty}\frac{(-1)^{n-1}\sigma_k^{(o)}(n)}{n^k}q^n$$
 A: The generalized Eisenstein series
\begin{equation}
\hat{E}_{k,\chi,\psi}(z):=\sum_{n=1}^{\infty}\left(\sum_{d|n}\psi(d)\chi(n/d)d^{k-1}\right)q^n\tag{1}
\end{equation}
Is a eigenform over the space $M_k(RL,\chi\psi)$ for characters $\psi$ and $\chi$ with conductors $L$ and $R$ respectively, whenever $L>1$ and $\psi(-1)\chi(-1)=(-1)^k$. More generally, for any $t>0$ the function $\hat{E}_{k,\chi,\psi}\left(z^t\right)$ is a modular form over $M_k(RLt,\chi\psi)$ according to this online textbook, Theorem 5.8.
We now set $\psi=1$ to be the trivial character and $\chi_=\chi_2$ to be the unique character modulo $2$. This means that $L=2>1$ and $\psi(-1)\chi(-1)=1$ so the conditions of (1) are satisfied if $k$ is even, making $\hat{E}_{k,\chi_2,1}(z)$ a modular (eigen) form. Now, if $k'$ is any odd integer we can let $k=1-k'$ be an even integer, so
\begin{equation}
\hat{E}_{1-k',\chi_2,1}(z)=\sum_{n=1}^{\infty}\left(\sum_{d|n}\chi_2(n/d)d^{-k'}\right)q^n
\end{equation}
is a modular form of degree $1-k'$ over $\Gamma_1(2)$. Since $\sum_{d|n}\chi_2(n/d)d^{-k'}=\frac{\sigma^{(o)}_{k}(n)}{n^k}$, this means that
\begin{equation}
\hat{E}_{1-k,\chi_2,1}(z)=\sum_{n=1}^{\infty}\frac{\sigma^{(o)}_{k}(n)}{n^k}q^n\tag{2}
\end{equation}
Relating this to $f_{k}(z)$ is now a straightforward task. Namely, we see that
\begin{align*}
f_k(2z+1)&=2i\sum_{n=1}^{\infty}\frac{(-1)^{n+1}\sigma_k^{(o)}(n)}{n^k}\exp\left(\frac{2\pi in(2z+1)}{2}\right)\\
&=-2i\sum_{n=1}^{\infty}\frac{\sigma_k^{(o)}(n)}{n^k}\exp\left(2\pi inz\right)\\
&=-2i\hat{E}_{1-k,\chi_2,1}(z)
\end{align*}
Thus, the transformation $f_k(2z+1)i/2$ turns $f_k(z)$ into a eigenform. Working out that $f_k(2z+1)i/2$ is an eigenform just from the formulae given in the problem statement seems hard, but also I am not aware of any general formula for Eisenstein series which yields the formulae given in the problem statement.
I find this stuff absolutely fascinating, and I'll be looking more into this and undoubtedly coming up with lots more fun stuff, so if anyone actually ends up reading this and cares about I'm writting then I will add more answers/edit this answer as time goes on to make the solution more complete. Thank you for your time.
