suppose you have N = 1000 points over an interval of one second. The time array is t = (0:999)/1000. [see note below]. Let f0 = 1 Hz and consider the complex waves
g_n(t) = exp(2*pi*i*n*f0*t) for n = 1,2,3, ...
Each g_n(t) oscillates n times in the time window.
The fft takes the signal, and for each m = 1,2,3 ...  multiplies the signal by g_m(t)* = exp(-2*pi*i*m*f0*t),  does a sum over all the array points and  reports out the answer.
Suppose your signal is a single oscillatory wave of amplitude 1 for a particular n0. After step  the fft will do a sum over all the points of the expression
B = exp(2*pi*i*(n0-m)*f0*t).
The result is 0 except when m = n0. In that case B = contant = 1 and the sum over the N points gives the result N. So if you want to recover the original amplitude 1 you have to divide the fft result by N.
[note] The array has 1000 points and 1000 intervals, including the interval from .999 sec to 1 sec, but does not include the point at 1 sec.