The implementation will depend on whether the solution is wired (DSL/Ethernet) or wireless and whether you'r charge / generating revenue from the service. If you're doing wireless I would suggest something like bluesocket (there are others though this is the one that pops to mind).
Through a combination of hardware and software the system will reconize a new MAC, provide an IP and determine if its authenticated. If the device isn't authenticated a page will be pushed to the client requesting authentication, regardless of the requested page. If you have a blank startup page in IE/Netscape the process won't start until you go to a target site. The server intercepts the request and pushes the authentication page. Until you're authenticated you won't be go any further.
Wireline solutions are much easier and are generally handled at a service port level. So if you're in a hotel room with DSL and you purchase a week of service the port will be activated (authenticated) for a week. Much lower overhead, though the authenitication is handled in the same way. I've seen software only and hardware based solutions. I would actually use an off the shelf solution instead of creating something, though it is possible to write your own.