It happens when the free-throw is a result of Technical foul.
Technical foul is particularly difficult foul or foul that is incompatible with the "Spirit of the game".
In the NBA, the penalty for a Technical foul is one free throw for the rival team and after it possession on the ball.
So in the case of technical foul there isn't a need that there will be players around the end-line.
There is also unsportsmanlike technical foul.
From NBA rule book:
A technical foul shall be assessed for unsportsmanlike tactics such
(1) Disrespectfully addressing an official
(2) Physically contacting an official
(3) Overt actions indicating resentment to a call
(4) Use of profanity
(5) A coach entering onto the court without permission of an official
(6) A deliberately-thrown elbow or any attempted physical act with no con-tact involved
I also seen cases when there isn't any offence players around the throwing player because it's the first throw or because they count on him to score or don't want to be causght surprise in fast break.