You goals - Kill the peasants - Take out key buildings - Destroy an entire town
Even though some newbies consider Warcraft a game like Sim City where you can build up your forces and watch them work, attacking is all Warcraft is about. (Even if you are using a wall in strategy, this is just for fending off early attacks and expanding later.)
There are different ways of how to achieve a major advantage with a well planned attack. You can
This is the best thing to do early in the game or if you are outnumbered. Having only few units ready, this is the way you can maximize your damage. Use a few wounded units to distract your enemy and send your other units to the gold mine. Try to kill as many peons as you can, and don't forget to hit any peons chopping lumber if possible! You don't have to kill these since the will stop chopping lumber and run away, standing around afterwards. If your opponent has only one mine, you can drastically cut down his gold supply this way. Just let your guys patrol or stand ground between the gold mine and the town hall (make sure they do not attack the opponent's main forces before they have arrived) and watch the peons die! (Use stand ground if you have three or more guys left to create a trap for the poor peons.) Many games are lost due to a high number of killed peons. Mages are the best units to do this. A single blizzard can kill a lot of peons if it is not stopped early.
Key buildings are mainly unique buildings like the fortress/castle, the foundry, the stables/ogre mound, the church/altar of storms, the lumbermill and the blacksmith. If you take them out, you will disable your opponent from making a particular kind of unit or from upgrading them. Sappers and mages/death knights with blizzard are the best units to do this. Since they have done their business after taking out the target(s), do not worry anymore about them. A mage without mana is useless and as good as dead anyway. And I have never seen a sapper survive an explosion :-) Don't go for these key buildings if there are more than two of them! In this case, you have to set up a large attack or choose a different target.
If you manage to take out the fortress, make sure can destroy at least one other building, preferably a mage tower. Then, your opponent has to upgrade twice again before being able to rebuild it. On land levels with low resources, he even won't be able to get back his castle! Destroying the castle is always devastating if you can take out another key building as well.
Destroying the foundry will stop your enemy's jugg reinforcements for a while; after that, try to destroy the opponent's fleet. Since you will have reinforcements available and the enemy does not, you have better chances to win if you know how to control your juggs.
Mage towers are the most important buildings if your opponent is human, but the orcish equivalent is also a good target. They have only 500 hit points and are relatively easy to destroy. However, there are usually several mage towers; you might consider going after the peons in that case.
Dragon roosts are nice to take out if your opponent could not use them much yet; otherwise, cut down your enemy's gold supply since that will stop the dragons equally well. Don't forget to build up a defense against the birds (destroyers, mages and archers, perhaps a few towers).
Alchemists are always a good choice. Since the sappers need a lot of time to be trained, this will hit your opponent very hard. Unless your opponent goes sapper happy (building 5+ gnomish inventors), destroying these buildings will slow down your enemy's sapper production a lot.
Attack the blacksmith and altar of storms only if your opponent has not upgraded his units yet. Otherwise, go for the stables/ogre mound: they are easier to kill (having only 500 hit points). On low resources in a land level, you can only build two additional blacksmiths after the first one, so consider that in your plans as well. If your opponent loses either the blacksmith or the ogre mound, he won't be able to produce ogres for a while. Build up a large attack force then and try to take advantage of that situation with another attack.
You should destroy the lumbermill if you are planning an aerial attack. Thus, you will be save from archers. Be aware that there might be another lumbermill to speed up the lumber harvest, though.
Barracks are only a good target if there are only two or less of them; otherwise, leave them. Destroying farms is only good when done in masses and if you haven't killed any other units yet. After losing four farms, your opponent's unit production will be stopped for a while, and his gold supply won't increase either. If your opponent builds his farms too close together (less than two matrices apart), you can take out two or more of them at once with a sapper, making them definitely the best target for them.
The objective is obvious: make sure that nothing is left after your attack. This is of course easier with a small expansion than with a well defended city. Therefore, if you see how your opponent sets up an expansion at a new mine, attack! He will still have to build an wall-in towers and move some units there, so he is most vulnerable at the beginning. Afterwards, attacking will become a lot harder.
If you see that you have superior forces, use them! Try to kill all your opponent's units, and use as many of your units for the attack as you can (depending from the number of transports and other players in the game). If you spare some units for later, you will only get higher casualties.
When attacking a larger town, kill the units in this order:
The buildings should be taken out in the same order as mentioned above: mage towers, dragon roosts, alchemists, altar of storms if not used yet, ogre mound, blacksmith, barracks, fortress, lumbermill, farms. Destroying farms won't make a difference at that point since your opponent will have lost many units. If you have four new sappers at hand after killing all the units, go for the fortress first. (You should not have any sappers left from the battle unless the defense was really weak.) If there are many mage towers and alchemists, take out the ogre mound first since it is the first unique building on your list.
Do not forget to send reinforcements when fighting a huge battle. Even though you will have to leave the battle for a few seconds, getting new units may be crucial for the outcome of your attack. Learn the shortcuts for training the units you need or you will lose too much time. (The same goes for any other shortcuts as well, of course.) Use the patrol command to make your units attack; you won't have to designate targets all the time this way. It is important that you know how to control your guys.