It completely depends on the site and your browser settings. if you check the "keep me logged in" box on a web page login, you will be logged in for however long the cookie is set for. Could be an hour, could be a month or forever. Otherwise, if you don't manually log out, many sites (especially ones that use SSL) will expire your session after x minutes of inactivity.
Browser functions/plugins can "remember" your login info indefinitely and prefill the user/pass fields, regardless of how long the cookie lasts.
It's totally up to you how you want to do this on your own machines, but if you are at the library, etc., you should manually click the "logout" link- probably a good idea to also clear the cache, search history and cookies; a well-administered public machine should do this on its own, but you really gonna trust that?
If you are at school or something where you have a user acct on the domain, you should log out of that as well when you're done. At the computer labs where I go to school, you'd be surprised how many people don't do that.