Your formula reminds a lot of the signature formula and obviously involves the inversion of permutations. Indeed, the sum $S(\sigma) = \displaystyle\sum_{1\leq i<j\leq n} \mathrm{sgn}(\sigma(i)-\sigma(j))$ almost counts the number of inversions (recall inversions are the number of pairs $\{i,j\}$ such that $i < j$ and $\sigma(i) > \sigma(j)$, one can see it as a way to quantify "disorder" of a permutation). If we call $\mathrm{inv}(\sigma)$ the number of inversions of a permutation, we have :
$$\mathrm{inv}(\sigma) = \sum_{1\leq i<j\leq n} X_{i,j}(\sigma)$$
where $X_{i,j}(\sigma) = 1$ if $i < j$ and $\sigma(i) > \sigma(j)$ and $0$ otherwise, while
$$S(\sigma) = \displaystyle\sum_{1\leq i<j\leq n} \mathrm{sgn}(\sigma(i)-\sigma(j)) = \sum_{1\leq i<j\leq n} Y_{i,j}(\sigma)$$
where $Y_{i,j}(\sigma) = -1$ if $i < j$ and $\sigma(i) > \sigma(j)$ and $1$ otherwise.
But, each pair $\{i,j\}$ is either order-preserving or not. So, (just consider each possible case) :
$Y_{i,j}(\sigma) = 1 - 2X_{i,j}(\sigma) $
Thus,
$$S(\sigma) = \left(\sum_{i < j} 1\right) - 2\mathrm{inv}(\sigma) = \binom{n}{2} - 2\mathrm{inv}(\sigma)$$
So,
$$\begin{align} f(m,n) &= \sum_{\sigma\in S_n} e^{-\frac{i\pi}{2m} \sum_{1\leq i<j\leq n} \mathrm{sgn}(\sigma(i)-\sigma(j))} \\
&= \sum_{\sigma\in S_n} e^{-\frac{i\pi}{2m} S(\sigma)} \\
&= \sum_{\sigma\in S_n} e^{-\frac{i\pi}{2m} \left(\binom{n}{2} - 2\mathrm{inv}(\sigma)\right)} \\
&= e^{-\frac{i\pi n(n-1)}{4m}} \sum_{\sigma\in S_n} e^{\frac{i\pi}{m} \mathrm{inv}(\sigma)} \end{align}$$
Now, the following paper which states this result :
Let $I_n(k)$ be the number of permutations of $\mathfrak{S}_n$ with $k$ inversions. Then, the $(I_n(k))_k$ have a generating function :
$$\Phi_n(x) = \sum_{k = 0}^{\binom{n}{2}} I_n(k)x^k = \prod_{j=1}^n \sum_{k = 0}^{j-1} x^k = \prod_{j = 1}^n \dfrac{x^j -1}{x - 1}$$
The paper gives a quite elementary proof of this result by induction. It is funny that the reference provided by the author for this result is a book from 1898 ! Anyway, the article uses this formula asymptotically but in our case we just use directly the formula :
$$\begin{align}\sum_{\sigma\in S_n} e^{\frac{i\pi}{m} \mathrm{inv}(\sigma)} &=\sum_{k = 0}^{\binom{n}{2}} e^{\frac{i\pi}{m}k} I_n(k) \\
&= \Phi_n\left(e^{\frac{i\pi}{m}}\right) \\
&= \prod_{j = 1}^n \dfrac{e^{\frac{ij\pi}{m}} -1}{e^{\frac{i\pi}{m}} - 1}
\end{align}$$
Now using elementary calculus :
$$e^{\frac{ij\pi}{m}} - 1 = e^{\frac{ij\pi}{2m}} 2 i \sin\left(\frac{j\pi}{2m}\right)$$
So :
$$\begin{align} \prod_{j = 1}^n \dfrac{e^{\frac{ij\pi}{m}} -1}{e^{\frac{i\pi}{m}} - 1} &= \prod_{j = 1}^n \dfrac{e^{\frac{ij\pi}{2m}} 2 i \sin\left(\frac{j\pi}{2m}\right)}{e^{\frac{i\pi}{2m}} 2 i \sin\left(\frac{\pi}{2m}\right)} \\
&= \prod_{j = 1}^n e^{\frac{i(j-1)\pi}{2m}} \dfrac{\sin\left(\frac{j\pi}{2m}\right)}{\sin\left(\frac{\pi}{2m}\right)} \\
&= \exp\left({\dfrac{i\pi}{2m}\sum_{l=1}^n (l-1)}\right) \prod_{j = 1}^n \dfrac{\sin\left(\frac{j\pi}{2m}\right)}{\sin\left(\frac{\pi}{2m}\right)} \\
&= e^{\frac{i\pi n(n-1)}{4m}} \prod_{j = 1}^n \dfrac{\sin\left(\frac{j\pi}{2m}\right)}{\sin\left(\frac{\pi}{2m}\right)}
\end{align}
$$
Combining our two results yields :
$$\begin{align} f(m,n) &= e^{-\frac{i\pi n(n-1)}{4m}} \sum_{\sigma\in S_n} e^{\frac{i\pi}{m} \mathrm{inv}(\sigma)} \\
&= \prod_{j = 1}^n \dfrac{\sin\left(\frac{j\pi}{2m}\right)}{\sin\left(\frac{\pi}{2m}\right)} \end{align}$$
which is coherent with your observation that $f(m,n)$ is always real. That fact can also be found independantly by passing to the conjugate and composing all permutation by the order-reversing permutation which sends $k$ to $(n-k+1)$.
This also explains why for $2m \geq n$, $f(m,n) = 0$ (the factor $\sin\left(\frac{2m\pi}{2m}\right) = 0$ is in the product).
And finally, this also explains why $f(m,2m-1) = f(m,2m-2)$ :
$$\begin{align} \dfrac{f(m,2m-1)}{f(m,2m-2)} &= \dfrac{\displaystyle\prod_{j=1}^{2m-1} \sin\left(\frac{j\pi}{2m}\right)}{\left(\sin\left(\frac{\pi}{2m}\right)\right)^{2m-1}} \dfrac{\left(\sin\left(\frac{\pi}{2m}\right)\right)^{2m-2}}{\displaystyle\prod_{j=1}^{2m-2} \sin\left(\frac{j\pi}{2m}\right)} \\
&= \dfrac{\sin\left(\frac{(2m-1)\pi}{2m}\right)}{\sin\left(\frac{\pi}{2m}\right)} \\ &= 1\end{align}
$$
I think you can find many non-trivial other properties and I hope they will help you with what you're doing with this expression ;)
EDIT : Also, I'm curious to know what led you to this expression !!
Best Answer
Except for the case of the upper and lower limit, all the other summations are really just sums of the form $$\sum_{P(i)} f(i)$$
Where $P$ is a unary predicate in the "language of mathematics", and $f(i)$ is some function which returns a value that we can sum. In the case of the sum of prime reciprocals $P(i)$ states that $i$ is a prime number and $f(i)=\frac1i$. In the second sum, $P(i)$ was $i\in S_n$, and $f(i)$ was that summand term. And so on.