Some general tips:

  • Walls are usually put as a front-line to stop runners, or around the mortar tower (it has min. range so it cannot hit units that are very close to it). Another variation is to populate the center with many towers (to hit runners from the side as they run to the resources) and surround it with walls. You get more walls as you progress - but never enough to surround all buildings. 
  • Bunkers are put mostly towards the back. They're strategic defenses you want to protect.
  • Towers and Bunkers are spread out (usually) so attacker can't target too many of them with spells or a horde of "landed" units.
  • Rune store is put in front - as it is a building with many HP, you don't mind to be destroyed. It's like a "dummy".
  • The castle is usually put at the center. it is an important building (an amount of winning points / stores some resources) but also it has good offensive capabilities and a lot of HP. some players choose to put the castle in the rear.
  • There are two philosophies for Mortar positioning: A: in the front lines (to hit gunners getting out of bunkers or enemy buildings) or on the rear (to protect the resource stores against runners and hit enemy after it broken down the front line), usually just behind the castle - that will take the hits and let the mortar live a bit longer. When you get 2 mortars this dilemma continues: some players put 2 mortars in front, some 2 on the rear, and other put one in front and on the rear.
  • Air defense is usually put at the tight second line of the front. It kills dragons, but you don't want it to fall first.
  • At the beginning of the game you'll probably put most of your defenses in the front, but as the game goes, you'll want to spread it more (not only because you get more defenses, but also because attack tactics change).