I am confused about when to include a prefactor of $\frac{1}{2\pi}$ when dealing with integrals of functions that are expressed as fourier series. This is what I understand (please correct me if I'm wrong). Assume I have a square integrable function, $f\left(x\right)$. I can express it as a fourier series according to:
$$f\left(x\right)=\sum_{k=-\infty}^{\infty} c_k e^{ikx}$$
Where the coefficients, $c_k$, are obtained via the following inner-product:
$$c_k=\frac{1}{2\pi}\int_{0}^{2\pi} e^{-ikx} f\left(x\right)\text{d}x$$
My understanding of the standard inner-product between functions is, that it is defined by:
$$\left\langle h\left(x\right),g\left(x\right)\right\rangle \equiv \int_{\Omega} h^*\left(x\right) g\left(x\right) \text{d}\Omega$$
Where the $^*$ denotes complex conjugation, $\Omega$ is the domain, and $\text{d}\Omega$ is the invariant measure.
So, using this definition, I would intuitively think that the coefficients for a fourier series ought to be computed from:
$$c_k=\int_{0}^{2\pi} e^{-ikx} f\left(x\right)\text{d}x$$
i.e. without the prefactor of $\frac{1}{2\pi}$.
Question 1: So, why is the prefactor of $\frac{1}{2\pi}$ included in the special case when the basis functions are complex exponentials, i.e. for Fourier series'? I know that the complex exponentials are not orthonormal, only orthogonal, but why should the normalization convention of the basis functions change the definition of the inner-product? I don't think it comes from the invariant measure, since for a circle the invariant measure should be $\text{d}x$, not $\frac{1}{2\pi}\text{d}x$
Now, say that I have an equation that is defined using an integral whose arguments include functions expressed as Fourier series. Specifically:
$$\bar{S} = \int_{0}^{2\pi} f\left(x\right)S\left(x\right)\text{d}x$$
Where $\bar{S}$ represents the average value of $S\left(x\right)$ weighted by the probability density function $f\left(x\right)$. If I express $f\left(x\right)$ and $S\left(x\right)$ as Fourier series, and use the fact that $f\left(x\right)=f^*\left(x\right)$, then the equation should be:
$$\bar{S} = \sum_{k=-\infty}^{\infty} \sum_{m=-\infty}^{\infty} c_k^* s_m\int_{0}^{2\pi} e^{-ikx} e^{imx} \text{d}x=2\pi \sum_{k=-\infty}^{\infty} c_k^* s_k$$
Question 2: In this case the integral amounts to doing an inner-product but without the prefactor of $\frac{1}{2\pi}$. So, when doing integrals of functions that are expressed as Fourier series do you need to always throw in that prefactor or not? When should you?
It depends on the inner product and the basis used.
Suppose you have an inner product $\langle \cdot, \cdot \rangle$ and an orthogonal (Schauder) basis $b_k$ for a Hilbert space $\mathbb{H}$.
If you represent some $f \in \mathbb{H}$ in terms of the basis, you will have $f = \sum_k \hat{f_k} b_k$, where $\hat{f_k}$ are the Fourier coefficients with respect to the basis $b_k$.
Then you have no choice over the $\hat{f_k}$, as they must satisfy $\langle b_k, f \rangle = \hat{f_k} \|b_k\|^2$, or $\hat{f_k} = \frac{\langle b_k, f \rangle}{\|b_k\|^2}$.
To answer your first question. Presumably you are dealing with $L^2[0,2 \pi]$, with $\langle f, g \rangle = \int_0^{2 \pi} \overline{f}(t)g(t) dt$, and the basis $b_k(t) = e^{i k t}$. Since $\|b_k\|^2 =\langle b_k, b_k \rangle = 2 \pi$, the coefficients are given by $\hat{f_k} = \frac{\langle b_k, f \rangle}{\|b_k\|^2} = \frac{1}{2\pi} \int_0^{2 \pi} e^{-ikt} f(t) dt$, whence the $2 \pi$.
For your second question, you have $\overline{S} = \int_{0}^{2\pi} f(x) S(x) dx$. In terms of the inner product from the previous question, this becomes $\overline{S} = \langle f, S \rangle$.
If $\hat{f_k}, \hat{S_k}$ are the Fourier coefficients (with respect to the basis and inner product above), then an easy computation (Parseval's theorem) shows that $\langle f, S \rangle = \sum_k \|b_k\|^2 \overline{\hat{f_k}} \hat{S_k}$, and so we obtain the result above (remember $\|b_k\|^2 = 2 \pi$).