There are a number of fundamental technologies that are used by measurement systems to collect visitor data. Here are a few of the most common:

Log files analysis
The original method for site stats reporting is by processing system log files that record all the requests made by visitors accessing the site via a browser. These log files can become large and need to be compressed and ultimately deleted to save server space. Also report generation is processor intensive and has to re rerun if any changes to the reports are required. This along with accuracy issues resulting from ISP and browser caching means that this approach is now less popular than it once was.

Page tagging
A much more popular technology now used by most modern site measurement systems is to place Javascript code on every page of the site this allows more accurate visitor data to be captured and the data is commonly processed in a relational database allowing for more sophisticate and timely reporting.

ISP analysis
Systems like Hitwise use data captured by ISPs to product market centric reports. These reports are based on a large sample size and can report on all sites as logs or page tagging is not required. The only short coming is that exact visitor numbers can only be roughly estimated and so market share (%) is often used to rank sites against each other.