So, final answer would be that [ -n "$STRING" ] will return TRUE if the variable “$STRING” has non-zero length. So what is the magic beyond this?
(1) First of all, what does read VARIABLE do?
It reads the actual line (first character from line to first occurrence of new line reserved character \n or EOF, which is the reserved character for END OF FILE). The thing with this sentence is that it returns TRUE only if the actual line ends with \n, but not with some specific EOF characters (it should, but some text editors use a different reserved character and it won’t work always).
PD: Every time read command is executed, it moves an internal pointer to the next line of $INPUT. So, what happens after read command reads the last line on INPUT (the one that ends with EOF)? It will return FALSE and VARIABLE will be returned empty.
(2) How does the last while iteration takes place?
First take a look at the condition: while read URL || [ -n "$URL" ] ;
So, because it is the last iteration, the actual line will end with EOF character. Therefore read URL will return FALSE (because line doesn’t end with \n), but URL won’t be empty, because there is an actual url there. This way, the first term of the while condition will be FALSE, but because URL is not empty, second term will be TRUE, which makes the whole condition to be TRUE. So, last line of INPUT will be processed as it should, despite having a weird EOF character.