One of the first things that TeX does after reading a line of input is deleting anyconverting the characters offrom the computer platform's character code 32(spaceencoding scheme to the TeX engine's internal character) encoding scheme. With traditional TeX engines the internal character encoding scheme is ASCII, the American Standard Code for Information Interchange. With TeX engines based on LuaTeX or XeTeX the internal character encoding scheme is Unicode whereof ASCII is a strict subset.
After that TeX deletes any space character at the right end of the line. More precisely: After that TeX deletes any character at the right end of the line whose character code is 32. (. 32 is the number of the code-point of the space character both in ASCII and in Unicode.)
Usually the space character (character code 32) isand the onlyhorizontal tab character (character code 9) are the only characters whose category code is 10(space).
That's why you can have several consecutive space characters or horizontal-tab-characters in the input usually yielding only one space token, in turn yielding whatsoever horizontal glue for only one horizontal space in case of TeX being in one of the modes where space tokens yield horizontal glue (, i.e., in horizontal mode, in restricted horizontal mode but neither in vertical mode, nor in internal vertical mode, nor in math mode, nor in display math mode).