TeX does read input line by line: A line of input will be read and processed. Then another line of input will be read and and processed. ...
One of the first things that TeX does after reading a line of input is deleting any characters of character code 32 (=space) at the right end of the line.
Then TeX inserts a character at the right end of the line whose character code equals the value of the integer-parameter \endlinechar.
Usually the value of \endlinechar is 13 (=return) and the category code of character 13 (=return) is 5.
This implies that usually TeX encounters a character whose category code is 5 when during tokenizing the line reaching the end of the line.
Then TeX starts tokenizing the line. I.e., TeX "looks" at the characters which the line contains and produces control sequence tokens and character tokens according to the category code table and according to the state of the reading apparatus.
At the time of reading and tokenizing input, the reading apparatus of TeX can be in one of three states:
State S: Skipping blanks. The reading apparatus is in that state after producing a space token or a control word token or after processing a character whose category code is 10 (space). In that state a space character in the input will yield not producing any token and not changing the state of the reading apparatus.
State M: Middle of line. The reading apparatus is in that state after producing a non-space character token or a control symbol token. In that state a space character in the input will yield producing a space token, i.e. a character token whose character code is 32 and whose category code is 10, and changing the state of the reading apparatus to state S.
State N: New line. The reading apparatus is in that state when about to start reading another line of input. In that state a space character in the input will yield not producing any token and not changing the state of the reading apparatus.
If TeX encounters a character of category code 5 while the reading apparatus is in state S, TeX will not produce any token at all.
If TeX encounters a character of category code 5 while the reading apparatus is in state M, TeX will produce a space token, i.e., a character token whose character code is 32 and whose category code is 10 (space).
If TeX encounters a character of category code 5 while the reading apparatus is in state N, TeX will produce the control word token \par.
After encountering a character of category code 5 TeX will - no matter what state the reading apparatus is in - in any case drop any further information on the current line and start reading another line of input. Hereby the reading apparatus of TeX will be switched to state N.
Due to the above-mentioned \endlinechar-thingie usually an empty line after a non-empty line will yield having TeX process two consecutive return-characters (character code 13) whose category code is 5.
At the time of encountering the first one, which is in the non-empty line, the reading apparatus might be in state S or in state M and therefore the first one might yield no token at all or yield a space token.
In any case after encountering the first one, the reading apparatus will be switched to state N. Therefore at the time of encountering the second one, the reading apparatus will be in state N and the second one yields the control word token \par.
That's why usually an empty line is treated like a "paragraph-break"/like the control word token \par which usually (if not redefined) is a directive for breaking into lines and typesetting as a paragraph of text the material collected/gathered by now.
This means that it can happen that the last thing within a paragraph is a space token yielding horizontal glue. Be aware that such horizontal glue at the end of a paragraph usually gets discarded by TeX and glue according to the values of the \parfillskip-glue-parameter gets attached at the end of a paragraph.