It's not correct to say that both expressions become equal when the signal is periodic. What is correct is that - obviously - everything one can know about an $N$-periodic signal is represented by the expression on the left of your equation, and consequently, both expressions are equivalent in the sense that one can be obtained from the other.
Note that that the infinite sum on the right-hand side does not converge in the conventional sense if the signal is periodic. The Discrete-Time Fourier Transform (DTFT) - that is what the right-hand side represents - of an $N$-periodic signal can be expressed by using Dirac delta impulses:
The coefficients $X[k]$ can be obtained from the expression on the left-hand side of your equation be setting $\omega_k=2\pi k/N$. In that sense, both expressions convey the same information.