Web push notifications work by using a combination of service workers and the Push API. When a user visits a website, they are prompted to allow notifications. If they agree, their browser stores a unique token. This token enables the site to send notifications to the user's device whenever needed. These notifications can be triggered by various actions, such as a new blog post, an abandoned cart, or a special offer.