Demo to get Matter Power Spectrum in cosmology
This is just a Fourier transform: (let $\boldsymbol{x}=\boldsymbol{r}_2-\boldsymbol{r}_1$)
$$
\begin{aligned}
\langle \delta(\boldsymbol{k}_1)\delta(\boldsymbol{k}_2) \rangle&amp;=\int\int d^3r_1d^3r_2\langle  \delta(\boldsymbol{r}_1)\delta(\boldsymbol{r}_2) \rangle e^{-i\boldsymbol{k}_1\cdot\boldsymbol{r}_1}e^{-i\boldsymbol{k}_2\cdot\boldsymbol{r}_2}\\
&amp;=\int d^3r_1 e^{-i\boldsymbol{k}_1\cdot\boldsymbol{r}_1}\int d^3r_2\langle\delta(\boldsymbol{r}_1)\delta(\boldsymbol{r}_2)\rangle e^{-i\boldsymbol{k}_2\cdot\boldsymbol{r}_2}\\
&amp;=\int d^3r_1 e^{-i\boldsymbol{k}_1\cdot\boldsymbol{r}_1}\int d^3x\langle\delta(\boldsymbol{r}_1)\delta(\boldsymbol{r}_1+\boldsymbol{x})\rangle e^{-i\boldsymbol{k}_2\cdot(\boldsymbol{r}_1+\boldsymbol{x})}\\
&amp;=\int e^{-i(\boldsymbol{k}_1+\boldsymbol{k}_2)\cdot\boldsymbol{r}_1}d^3r_1\int\xi(\boldsymbol{x})e^{-i\boldsymbol{k}_2\cdot\boldsymbol{x}}d^3x\\
&amp;=(2\pi)^3\delta_D(\boldsymbol{k}_1+\boldsymbol{k}_2)P(\boldsymbol{k}_2)
\end{aligned}
$$
Here, $\langle\delta(\boldsymbol{r}_1)\delta(\boldsymbol{r}_2\rangle)$ is two-point correlation function (2pcf) in real space. If we assume our universe is statistically homogeneous, $\langle\delta(\boldsymbol{r}_1)\delta(\boldsymbol{r}_2\rangle)$ should have the form $\xi(\boldsymbol{r}_1-\boldsymbol{r}_2)$. So power spectrum is the Fourier transform of 2pcf.
In addition, if we assume our universe is statistically isotropic (not true in redshift space), 2pcf can be $\xi(|\boldsymbol{r}_1-\boldsymbol{r}_2|)$ and power spectrum can be $P(k)$.