To sign out of Gmail or Google Apps, click on your email address in the top right of your screen and select Sign out.
You may not want to sign out each time when using your own PC, but it is particularly important to sign out if you are accessing your account on a shared computer or public network. However, if you forget to log out, you can log out of all previous sessions the next time you are at a computer.
To do this, open your Gmail or Google Apps account and click on the Details link in the bottom right of your screen. This will open up a pop up window where you can see recent activity, whether your Gmail or Google Apps account is open in any other location, and choose to Sign out of all other sessions. Clicking that button will ensure all your previous Gmail and Google Apps sessions are logged out, leaving you logged in to the current computer only.