Every time a search engine directs someone to your site, the system records here which search engine was involved and what search criteria were used. If the page request came from your own site that data is stored too.
This extensive database is then used by the system to report on the traffic that your site receives.