Generally speaking, macros will give you a bit more control over how you cast a spell. They can’t be used to make decisions for you, but they can have a button press do different things depending on context. A common example would be that if your target is friendly, it will cast a heal spell, or if your target is hostile it will cast a damage spell.
Occasionally, you can combine several actions into a macro to have them all go off at once. This only works when stuff isn’t on the Global Cooldown. Most stuff is on the global cooldown, so it’s use is limited. (The main stuff that is off the global cooldown are trinkets and some racial abilities.)
In the case of the macros Astryss posted, it’s combining having your pet do stuff at the same time you do your own stuff, as those actions can be done simultaneously. (Having the 3 different pet attack types in the macro just means it will work for whatever pet you have out — each pet will only be using one of them.) Those type of pet macros are useful because your pet is supposed to do attack your target and use their abilities, but sometimes they are dumb and those macros force the pet to attack your target if for some reason they get “distracted.”
There’s a guide in the UI and macro forum that give a good overview.