When sed reads Line 1 (2, 3), since this is not Line 4, thus matching '4!', therefore command 'd' will be executed; therefore this line will be discarded, and sed will start the next cycle (read the next line to PS and execute command from [1]).
After reading Line 4, sed will NOT execute command 'd' in [1]. Line 4 is 'survived' and control flows to [2].
Command 'q' will print the contents of PS (currently contains line 4) and sed will be terminated.
If you want to get the Nth line, just replace '4' in the script with number N.