The extension sends a request to the About page (which is the most lightweight page on the site) every `N` seconds (which can be adjusted in the options) and looks for the notification and message counters on the page.
The total amount is then displayed on the icon, and when clicked it opens a menu that looks similar to the site's top bar with the notifications and messages icons, both of which can be clicked to go to their respective pages. You should choose the domain you're normally signed in on using the options, otherwise the extension can't keep count of your notifications and messages.
If you browse the site on the domain of your choosing the extension will keep the count synced with the page contents without having to wait for the next timed update.
By default the the extension sends a notification and plays a sound when the total increases, but both the notification and its sound can be disabled if you only want the counter. The notification will not disappear automatically by default, only a click on the close button or one of the buttons will clear it. However, this can be changed by setting the timeout to a value other than 0 in the options.