The main way that they do this is through links, they crawl from one link to another and find websites and then establish or determine what that website is relevant to so.
The process of link building for marketing purposes is to cast a wider, stronger net for search engines to frequently find your website and determine its authority. The main two processes for link building are internal link, building which occurs within a site and external link, building which occurs from out outside or external web sites, pointing to your web site of interest and the main factors.
I would say to take into account when you are doing link building is the link or the text that the link passes through the area on the page where the link is coming from and the overall web site where the link is coming from as well.