Scripts can have accounts too. It would be easy for a spammer or other malicious user to sign in and then give control to his script. Having the possibility of a CAPTCHA for signed-in users prevents this attack.
The system has a few ways to guess whether particular activity is from a genuine user. Full details aren't available to us end-users, because that would make the system too easy for attackers to defeat.
One common way to make the check go wrong is to leave a page open for a long time before submitting the form; for example, you start to answer a question, then get interrupted, go to lunch, come back an hour later, finish answering the question, and then get the CAPTCHA when you try to post your answer. This is because of a token in the page that expires after some time.