Before attempting to update your Mac to OS X 10.9, or Mavericks, ensure you've backed up all your important files. Use a utility such as Time Machine for this. Also, ensure you have an active Internet connection.
To find whether there is an update in the Mac App Store, go to Apple menu, then click on Software Update. Once the Mac finds the update, install it. Do not interrupt the computer once you've started the update process. If you are updating multiple computers, avoid downloading the update many times by downloading the offline update installer from Apple Support Downloads. Note, however, that if you have modified your operating system in one way or another, you may experience unexpected results during the update process.
If you already had Mavericks installed and you want to reinstall, you can either do that while erasing your files, applications and settings or while erasing everything on your computer. To do the former, restart your Mac, then press Command and R until the Apple logo displays. Choose a language, then click the arrow to proceed.
Next, click on Reinstall OS X, and click Continue. Follow the instructions, select the hard drive and click Install. If prompted to enter your Apple credentials, do so. Once the installation is complete, go to the Apple menu and install available updates.