First check to see if your system meets the system requirements to upgrade.
Lion system requirements are:
- Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7, or Xeon processor
- 2GB of memory
- OS X v10.6.6 or later (v10.6.8 recommended)
- 7GB of available space
(Mountain Lion requirements are shown here: http://support.apple.com/kb/HT5444.
Mavericks requirements are shown here: http://support.apple.com/kb/HT5842.
If you can run Mavericks, you can purchase an upgrade from the Mac App Store. If you can only run Lion or Mountain Lion, contact the online store in your country and purchase a redemption code to download it from the Mac App Store.
After upgrading, you will find iCloud in System Preferences>iCloud on your Mac, and can set it up as explained here: http://www.apple.com/icloud/setup/mac.html.
Before upgrading, you may want to check the compatibility of your existing programs by checking here: http://roaringapps.com/apps:table.