Usually it's done with either cookies or a database.
vBulletin gives you 3 options if I recall correctly, cookies and 2 database options.
Cookies being the least server intensive option, the 2 databases options offers two levels of accuracy whereas the most accurate option can be very cpu intensive on large forums with lots of threads.