The way log in works is as follows:
You enter your correct credentials.
The site accepts your credentials and sends back a cookie (a small unique string of characters that identifies your account) for your browser to keep.
If you had checked the ‘Remember me on this computer’ box, then the site tells the browser to keep the cookie for more than a year. If you didn’t, it tells the browser to keep it until you close the window/tab.
With every subsequent request to the site, whether it’s for a full page, or an image, your browser sends back this cookie to the site, so that it can tell who is making the request.
If you click ‘Sign Out’, the server tells your browser to delete the cookie.
This process is precise and must not be interfered with in order to work perfectly.
However, these days there are many factors that can affect this usually reliable mechanism. If you’re having trouble staying logged in look for these things:
Check your browser’s configuration. It must be set to accept cookies from the visited page. No need for third party cookies. Some browsers have the ability to treat all cookies as ‘session’ cookies, which means they get deleted after closing the window/tab.
If you have security software, make sure it’s not configured to delete unwanted browsing data.
If you’re using ‘Private Browsing’ or ‘Incognito Mode’, then all data, including cookies, is deleted when you close the window or tab. You can't use private/incognito mode and stay logged in.