You can do this MANY ways.
I prefer PHP and MySQL. You can do it with JavaScript, Java, ActionScript.
Easiest way is to make a simple database and count how many times a page is accessed with a server side programming language.
or
You could count how many times an image is requested and put that image anywhere you want to count the hits.
If you don't want to do this with the site logo for example.
You can use a 1x1 clear .png file. (won't be seen)
There are so many ways. You are going to have to let us know what we are working with here.