A thread can be locked for a variate of reasons. If there is no message from a mod in the locked thread, they might have placed a tag in the title instead, which will explain the lock: [ans]: The thread has been answered. [dup]: The thread is a duplicate to another thread. [spam]: The thread has been spammed to the point where it can no longer be salvaged. [OPspam]: The opening poster/creator of the thread spammed in creating the thread. [req]: The creator of the thread has requested for it to be locked. [necro]/[nec]: This thread has been inactive for too long, and someone posted in it regardless. [old]: Same as above, the reviving post might just have had a point, though the thread is still too old to have around. [caps]: WE DON'T LIKE YOU TALKING LIKE THIS. [adv]: The thread contains advertisement for a site, video or anything such related, without any discussion. AG prohibits advertisement of any kind, referrals included. [what]: Exactly what is says. The moderator that locked the thread has no words. [No.]: There is breaking the rules, and then there is breaking the rules. This tag is placed if someone is breaking the rules seriously and in such a way that a moderator has no words or patience to write out a proper message.
There are a few more maybe. And mods usually leave a message that's quite clear if it's not any of the above.
To add to the list already stated by nichodemus... when a thread is answered or the problem is solved, there's no use for it to keep open for posting. This usually renderes the echo-ing of the exact same answer and the discussion itself dies. Sometimes a problem is addressed and answered, but the thread stays open when it still generates enough posts adding to a discussion about the topic itself.