Often times there are very complex spidering programs involved. By starting with simple page elements like titles, urls, headers, bold text, and descriptions, and keyword density, you can get pretty close to an algo and have a starting point for building your own pages. Some times it may take as many as 50,000 pages to get an algo to 'line up'. Crackers will take all the page data and make scatter charts to find where the algo all comes together. Often times the data is shifted into a spreadsheet where 3d chart making is easiest.
Search engines are very wise to the above techniques.
They will often rotate algo's slightly on a daily or weekly basis so that top sites will float out of the mix. Another current top engines will put in algo randomization to almost poison their own listings. One ranking position will want the keyword in the title, the next in the url, the next in the description, and so on until trying to look at the results as a whole is impossible. Even with the above efforts , I know of one current Seo firm that has programmed the entire cracking process and can run the algo cracker at will. It takes a great deal of technical knowledge and programming skills to crack an SE algo - getting tougher every day.