I want to understand precisely where the formula for the expectation value of $x$ comes from (in QM): $$\langle x\rangle=\int _{-\infty}^{\infty}\psi ^*x\psi dx $$
I know that an expectation value (in statistics) is just the sum of the products of the possible values $f(x)$ times their probabilities $\rho (x)$: $$\langle f(x)\rangle=\int f(x) \rho (x)dx $$ Since in QM mechanics the probability is given by $|\psi|^2 $, the expectation value of $f(x)$ would be: $$\langle f(x)\rangle=\int f(x) |\psi|^2dx=\int f(x)\psi^*\psi dx$$ But this differs from the form above. If $f(x)$ was Hermitian I could use the property of Hermitian operators to "move it" into the position that it should be, but since it is not necessarily Hermitian, I don't know how to explain this difference, or how to solve it. I have consulted Griffith's QM and also online, but I cannot find an answer.
What am I missing here?