So I'm going through the path integral derivation for a general quantum system where the generalized coordinates and momentum are given as $q^i$ and $p^i$ respectively. The transition amplitude we would like to compute is given as $$U(q_a,q_b;t) = \langle q_b| e^{\frac{iHt}{\hbar}}|q_a \rangle.$$ The author mentions to insert a complete set of indeterminate states between each of the $e^{iHt}$ terms, that is, insert $$ 1 = (\prod_i\int dq_k^i)|q_k\rangle\langle q_k| $$ (partitioning them into $\epsilon$ slices). This is all fine, but the next step the author says if we consider $H$ to be a function just of $q$ we then have $$\langle q_{k+1}| f(q)| q_k\rangle = f(q_k) \langle q_{k+1}| q_k\rangle = f(q_k) \prod_i \delta(q_k^i-q_{k+1}^i). $$
This part follows nicely, but he claims that we can write it as $$\langle q_{k+1}| f(q)| q_k\rangle =f(\frac{q_k+q_{k+1}}{2})\left(\prod_i\int \frac{dp_k^i}{2\pi}\right)exp[i\sum_i p_k^i(q_{k+1}^i-q_k^i )].$$
Where does $p$ come from here and why does $q_k$ get replaced with the midpoint of $q_k$ and $q_{k+1}$? Also, where does the exponent come from and why the $2\pi$?