When I enable line numbers in Emacs the cursor starts in a line with no number in it. If you press enter then the numbers increment but always there is a line with no number. Why is that happening?
Because the last line hasn't started yet. Adding newline symbol to the end makes the cursor jump from the current line to the next one, but it doesn't add anything to it (new one). Strictly speaking, it is not a line yet.
Supposing that every newline symbol was visible, you would get
1. <newline_symbol> 2. <newline_symbol> 3. <newline_symbol> <cursor_there_and_nothing_else>
Once you start typing in this line, it receives some content, so the number will appear.