There are two situations when you can use an apostrophe: contractions and for possession. I will start with contractions as this is the easiest.
A contraction is when you squash two words into one shorter word, for example “do not” becomes “don’t”. The general rule us that the apostrophe replaces any letters that are left out. Try to think of a few examples of other contractions. We usually use contractions when we speak and when we are writing informal English. When we are writing formal English we should avoid using contractions and white the words out in full.
Possession is when something belongs to something else. For example, my name is Nick and I own a ball. We could say “that ball belongs to Nick” or we could say “that is Nick’s ball”. In this case we have made it possessive by adding - ‘s. We use the apostrophe when the owner is written before the object (noun) and it comes between the owner and the s: “Nick’s”.
This also happens when the owner is itself an object; for example “the chair’s leg”. In this case the leg belongs to the chair.
This gets a little more complex when the owner already has an s as its last letter, for example if it is plural (eg when there are many chairs), or if it is a proper noun that ends in s (eg a name such as Mr Evans). There is no correct answer about what to do in this situation, it depends on your own style, your own teacher, and what your own exam board wants. You can either do the same as above and add – ‘s so that a ball that belongs to Mr Evans is “Mr Evans’s ball”. Alternatively you can knock off the final s so that the apostrophe hangs at the end: “Mr Evans’ ball”. As I said, neither is definitively wrong, but I personally prefer this second option as it sometimes looks odd if you have too many ss.
A small note on when not to use an apostrophe: never with plurals! If you are making a word plural add an s (unless it is irregular) but do not add an apostrophe!
One cat: “the cat’s tail is long”
One cat: “the cat’s whiskers are white”
Several cats: “the cats’ tails are long” (notice that the possessed item (tails) is now plural because there are now several tails)
Several cats: “the cats’ whiskers are long”