To expand a bit more on the comments, measurement of the second (lower) register after preparing this register to be in $\vert a^j\bmod N\rangle$ and prior to performing the inverse QFT of the first register is not necessary, but may be a useful fiction we tell ourselves.
For example I'll quote whole-cloth from Greg Kuperberg on Shtetl-Optimized:
- You can measure the output qubits.
- The janitor can fish the output qubits out of the trash and measure them for you.
- You can secretly not measure the output qubits and say you did.
- You can keep the output qubits and say you threw them away.
The reason it may be convenient to think of measuring the second (lower) register prior to the inverse QFT of the first (upper) register is that, if you measure the second register and get an output $y$, this enables you to picture the first upper register as collapsing to a comb corresponding to the uniform superposition of all $j$ such that $a^j\bmod N=y$. These $j$ are just binary numbers, but magically they are spaced evenly at $r$ steps apart. The inverse QFT, plus the other classical tricks with continued fractions, enables you to figure out what this $r$ is.
Notice that if you had measured the second register and had gotten a different $y$, then your comb would have been shifted over, but your spacing would still be $r$.
Alternatively, if you do not want to picture measuring the second register to get $y$ and collapsing the first register to the uniform superposition of all $j$ such that $y=a^j\bmod N$, then after the QFT the first register will still be in a state inversely proportional to $r$. The global phase of this state would be dependent on the specific $y$ that you would have measured, if you had measured the second register, but you didn't measure the second register. This global phase can I think be thought of the amount of shifting mentioned above, but importantly this global phase is irrelevant to the state of the first register.
Trying to relate an intuition about classical discrete/fast Fourier transforms to quantum Fourier transforms, there is always a risk that there are subtleties that are left behind. Nonetheless one could consider the wavefunction, after calculating the modular exponentiation in the second register, as something similar to a $1\times N$ array, such as:
where each index corresponds to the first register, and the value of the index corresponds to the second register. (I made up these numbers, but note that there is a period of $8$, for example).
You may also think of the wavefunction as having another array parallel to this $1\times N$ array; this parallel wavefunction corresponds to the amplitude of each basis state. Thus this parallel array might initially be a normalized version of:
It appears the OP is trying to envision this above probability array as independent of the above array of values. For example, clearly treated in isolation a Fourier transform of this array will indeed return $[1,0,0,0,0,0\ldots]$. But critically this probability amplitude array is tied to the above array of values of this matrix.
For example suppose we now we measure the second register and get, say, $2$ as an output. This collapses the wavefunction and changes our array of probability amplitudes to a normalized version of:
Certainly when we do the QFT on the above amplitudes, we will recognize the periodicity of $8$.
Alternatively if we had measured and gotten output of $10$, then our array of probability amplitudes would be a normalized version of:
The QFT in either case gives the same periodicity. The difference between measuring and returning the value of $2$ vs. the value of $10$ is only reflected in the physically irrelevant global phase of the output register.