How was this result on discrete Fourier series achieved?
Note that $x[n]$ has period $N$ and the sum you refer to has $NM$ terms, so the sum has the form

$$\sum_{n=0}^{NM-1}x[n]f[n]=x[0]f[0]+x[1]f[1]+\ldots+x[N-1]f[N-1]+x[0]f[N]+\ldots +x[N-1]f[2N-1]+x[0]f[2N]+\ldots=\\=x[0]\big(f[0]+f[N]+f[2N]+\ldots+f[MN-N]\big)+x[1]\big(f[1]+f[N+1]+\ldots+f[MN-N+1]\big)+\ldots+x[N-1]\big(f[N-1]+f[2N-1]+\ldots+f[MN-1]\big)=\\=\sum_{n=0}^{N-1}x[n]\sum_{l=0}^{M-1}f[n+lN]$$

With $f[n]=e^{-jk2\pi n/NM}$ we obtain

$$\frac{1}{NM}\sum_{n=0}^{NM-1}x[n]e^{-jk2\pi n/NM}=\frac{1}{NM}\sum_{n=0}^{N-1}x[n]\sum_{l=0}^{M-1}e^{-jk2\pi (n+lN)/NM}\tag{1}$$

For the other sum over $y[n]$ you can do exactly the same. The final result is obtained as follows. The right-hand side of Eq. $(1)$ can be written as

$$\frac{1}{NM}\sum_{n=0}^{N-1}x[n]\sum_{l=0}^{M-1}e^{-jk2\pi (n+lN)/NM}=\frac{1}{NM}\sum_{n=0}^{N-1}x[n]e^{-j(k/M)2\pi n/N}\sum_{l=0}^{M-1}e^{-jk2\pi l/M}\tag{2}$$

The last sum over $l$ in Eq. $(2)$ is given by

$$\sum_{l=0}^{M-1}e^{-jk2\pi l/M}=\begin{cases}M,&amp;k=mM,\;m\in\mathbb{Z}\\0,&amp;\text{otherwise}\end{cases}\tag{3}$$

Consequently, for $k=mM$, Eq. $(2)$ evaluates to

$$\frac{1}{N}\sum_{n=0}^{N-1}x[n]e^{-j(k/M)2\pi n/N}=\frac{1}{N}a_{k/M}\tag{4}$$

where $a_k$ are the discrete Fourier series (DFS) coefficients of $x[n]$.
For other values of $k$ the expression in Eq. $(2)$ equals zero. Exactly the same manipulation can be done with the sum over $y[n]$.