Here's the process this type of functionality follows:
1. HTML page contains a form that collects username and password
2. The form gets submitted to a page of another language, such as PHP or ASP
3. The receiving page checks the submitted information against the contents of a database (MySQL, MSSQL, etc)
4. The page processes the result of the database query, and either accepts or rejects the login
Following this step, usually a cookie or session is created, so that the site remembers who the user is without having them login every time they change pages.