I wonder how it works... Maybe it goes into already-indexed sites looking for links that leads to sites that are not indexed
Indeed. But you do need to directly communicate to a search engine the presence of a new domain, let's say spacecows.com, there's a page/procedure for this. Then it will analyze the website structure, how much is linked to existent websites in order to calculate a certain "weight" for the site. Bots will analyze periodically for changes.
Bots cannot register in forums, it would be the end of the internet

They simply navigate thru posts as guests, they behave like browsers but instead to announce themselves as "USER_AGENT=Mozilla Firefox 50.0" or something similar, they request pages as "USER_AGENT=
Googlebot", for example. Hence the PHP code used by the forum will assign "Google [bot]" to the bot guest, making it as a known user.
Imagine what would happen if some user-eyes-only threads were indexed... Bloodbaths at least
