Drupal have lots of magic features and though they frustrate developers in the beginning, once you know the details its super easy and helps a lot. One such thing is the adding of Login and Logout links in a menu and making them toggle dynamically based on the user is logged in or out. Lets see how to do it.
Log in to the Drupal Admin
Go to Structure > Menus
Click list links of the menu where you want to add the links
Click on Add Link
Add a link with Path = user/login , Menu link title = Login and click Save
Click on Add Link again
Add another link with Path = user/logout , Menu link title = Logout and click Save
Reload the site and see the magic for yourself. Drupal will automatically show the Logout and Login links based on whether you are logged in or out.