When a peon is constructing a new building, you can repair it even if it hasn't got any damage yet. Just assign a peon to repair it! That speeds up the construction a lot, although it is pretty costly. It is a good choice to use this trick when you need a building very soon (e. g. a barracks).
Unless you need the resources elsewhere, always repair
Towers should also be repaired at the beginning of the game; they are the most expensive buildings (after town halls) and have the least amount of hit points. Later, at keep or fortress stage, towers become less useful anyway and a repair is pretty useless if you face catapults or a horde of sappers - or mages.
Always repair a building which is important and below 400 hit points, because it could be sappered and gone instantly. Just repair a few hit points to bring it above 400, don't repair it entirely because that costs too much lumber.
Therefore, always repair a barracks or great hall that has been sappered once because it is highly unlikely not to get sappered again very soon :-) . You have to react very quickly, though, or your peons arrive just in time to see a wonderful explosion. You need only to repair one single hit point to save your barracks/fortress if your enemy hasn't got an extra sapper ready (and even then, you'll save one of your farms that way).
Beginners always repair everything they own, despite the existence of sappers who can destroy a farm at once anyway etc.
This is devastating. At the beginning, you just can't afford to lose any resources (because the loss of 1 lumber is equal to the loss of 100), and it really doesn't matter when a building is on fire. (It even looks beautiful ;-) ) When you're behind the town hall stage, repairings don't cut your supplies that crucially any longer because you'll get 10 additional gold per mining trip. (Of course, you need a lumbermill to enhance your lumber harvest as well).
Even then, a building that is under attack will very probably be destroyed anyway, so forget about it and build a new one. E. g., if your harbor has just been blown up, build a few catapults/mages with blizzard to be able to defend the next one and then build a new one. If you managed to take out all the enemy ships before, even better. When upgrading, it is always safer to cancel the upgrade (especially with towers), but often worth the effort to protect the building (e. g. the blacksmith/mage tower) until the upgrade is finished. That depends. By the way, if you train a guy and the building goes down, you get the gold back!
Don't waste your time checking the current state of the buildings. You should know their hit points by heart and be able to tell if it's below 400 points when you see the fire (be careful with the barracks, though; the fire will be small even though it has only 400 hit points left). Just check the buildings which are burning and don't care about a scratch in the facade, right?
It is quite pointless and eats up his resources. Period. No reason to stop that (unless you want to end the game).
However, be careful when you're trying to sapper a blacksmith with two demo squads, because if it can be repaired a bit (26 hit points), the second sapper won't destroy it. When attacking a barracks or a fortress with sappers, have a another sapper or a mage ready to destroy the building if a peon has repaired it (it should then have only a few hit points left).
That's it. I hardly ever repair something unless it's one of the exceptions from above and do quite well that way.