Confusion relating to discretizing a Lagrangian and the Fourier transform conventions thereof

My question boils down to how the Fourier transform is discretized when we discretize the field $$\phi(x)$$ in a Lagrangian $$\mathcal{L}$$. To put things on a concrete footing, consider the following Lagrangian (from exercise 17.5 of Lancaster and Blundell): $$$$\mathcal{L} = \frac{1}{2}\left(\frac{\partial\phi(x)}{\partial x}\right)^2 + \frac{m^2}{2}\phi(x)^2,$$$$ in one dimension. (Please correct any mistakes in this preamble!)

Ordinarially, we would define the Fourier transform relations as $$$$\phi(x) = \int\frac{\mathrm{d}p}{2\pi}\tilde{\phi}(p)\mathrm{e}^{ip\cdot x}\longleftrightarrow \tilde{\phi}(p) =\int\mathrm{d}x\phi(x)\mathrm{e}^{-ip\cdot x},$$$$ leading to the delta function relation $$$$\frac{1}{2\pi}\int\mathrm{d}p\;\mathrm{e}^{ip\cdot y}=\delta(y).$$$$ L&B introduce discretization into the problem by defining the relationships: $$$$\phi_j=\frac{1}{\sqrt{Na}}\sum_p\tilde{\phi}_p\mathrm{e}^{ipja}\longleftrightarrow \tilde{\phi}_p=\frac{1}{\sqrt{Na}}\sum_j{\phi}_j\mathrm{e}^{-ipja}.$$$$ Where $$a$$ is the lattice spacing, $$N$$ the number of lattice points and $$j$$ an index which labels the lattice points. However, this seems to imply that $$$$\frac{1}{Na}\sum_k\mathrm{e}^{ikja} = \delta_{j,0}.$$$$ Here is where I am confused. Surely if $$j=0$$ in this equation, then $$\sum_k = N$$ - so where does the $$a$$ come from? Generally I am unsure how one derives these discretised Fourier relations. If anyone could point me in the right direction to actually understanding where they come from, in particular relating to the prefactors $$1/\sqrt{Na}$$, then I would be very appreciative.

EDIT: Why $$\int\mathrm{d}x\rightarrow Na\sum_j$$ also confuses me deeply - this time, it seems to me that $$\mathrm{d}x\rightarrow a$$, and hence that the $$N$$ should not be there!

Intuitively there is a relationship between periodicity and being discrete between dual spaces (time vs frequency or space vs wavenumber).

Periodicity in one space implies being discrete in the dual space and vice versa.

There are four cases:

1. The continuous Fourier transform is suited when representations in both dual spaces are non-periodic and are non-discrete.

2. The discrete-time Fourier transform (DTFT) is suited when representation in one space is discrete but not periodic and in its dual space is periodic but not discrete.

3. The Fourier series is suited when representation in one space is periodic and not discrete and in its dual space is discrete but not periodic.

4. The discrete Fourier transform (DFT) is suited when representation in a space is both periodic and discrete and it is also that way in the dual space.

Note that 2) and 3) can be used to describe the same situation, just interpreted differently depending on which one you think is the "original/natural" space and which is the transform.

Regarding the $$\frac{1}{N}$$ term - this shows up whenever go from a periodic function to its dual (which must be discrete) - you divide by the period.

In the wiki DTFT inverse transform definition linked to above, there is a $$\frac{1}{2 \pi}$$ factor for this factor.

In the wiki Fourier series definition linked to above, there is a $$\frac{1}{P}$$ factor for this factor.

For the DFT, both dual representations are periodic. In some definitions of the DFT, the $$\frac{1}{N}$$ factor is excluded in the forward transform and present in the inverse transform. You can also define a version of the DFT that basically symmetrically shares the square root of the term in both directions $$\frac{1}{\sqrt{N}}$$. The only requirements really for the DFT and its inverse are that the exponents have opposite signs and the product of the two scaling factors is $$\frac{1}{N}$$.

Hope that helps with the intuition behind the different Fourier transform variations.