One of the most important actions that your theme's users will take is to log in and out of your WordPress installation. Many installations limit certain content to logged-in users, so login and logout links must be prominent and correct.
For security purposes, logout links must contain a specially-constructed nonce (basically, a secure key), so it isn't good enough to point to the login page with a specific action argument. Using the WordPress functions, you can display login and logout links with one simple function call.
Open a template file that you wish to insert the login/logout link into. Generally, you want login/logout functionality to be available across your entire site, so a good place for this code is in your header or sidebar. Place your cursor wherever you want the login/logout link to appear, and then insert the following code:
<?php wp_loginout(); ?>