I've heard that there are some safety and building code issues involved with using extension cords or power strips (surge protectors) for anything other than temporary use. What are the issues, and how can extension cords be used safely?
This is one of the biggest problem with power strips (surge protectors)...
The average person does not think about how much power each device is drawing, or how much the system can handle, they just see an open outlet and plug stuff in. If they can't find an open outlet... Oh yeah! they make adapters for that! I mean they sell the adapters, so they must be safe... Right?
If your power strips look like this (or worse), you better at least be checking the batteries in that smoke alarm (which is hopefully not plugged into this power strip too).
If you are using the power strip (or extension cord) properly (one plug per outlet, no adapters, no daisy chaining) and you inspect the power strip for damage (wear & tear) regularly, you should not have much to fear.
Another thing to look at when using a power strip or extension cord, is the size of the wire and the voltage and amperage ratings. If you are using things like electric heaters, power tools, vacuums, etc., make sure the wire (extension cord/power strip) is the proper size to handle the above average load of these types of devices. Overloaded wire can heat up quickly and cause a fire.
Basically if you use common sense, inspect the cables for obvious damage and/or wear & tear regularly, and use the cables for their intended purpose, you should have no problems using extension cords and/or power strips.
The National Electrical Code (NEC) has a whole article devoted to flexible cords and cables, one of the more applicable sections in this case would be 400.8.
400.8(1) As a substitute for the fixed wiring of a structure.
400.8(2) Where run through holes in walls, structural ceilings, suspended ceilings, dropped ceilings, or floors.
400.8(3) Where run through doorways, windows, or similar openings.
400.8(4) Where attached to building surfaces.
400.8(5) Where concealed by walls, floors, or ceilings or located above suspended or dropped ceilings.
400.8(6) Where installed in raceways, except as otherwise permitted in this Code
400.8(7) Where subject to physical damage
An extension cord is generally not fire-rated; the insulating covering over it will either sustain a fire (unlikely in most cases as they must still meet basic electrical fire codes), or release toxic chemicals when burned (more likely). Extension cords, though durable, are also not built for in-wall or under-floor installation; the insulation will after several years harden, crack and split, exposing the wire and causing a fire hazard.
However, all this means is that such wires are not designed for permanent installation into a home. As long as you use it in a manner such that the cord can be unplugged, removed and thrown away when the cord deteriorates, and you expect that to happen after some years, especially outdoors, you're fine.
Don't run an extension cord under a rug. When people walk on the rug it will rub on the cord, and over time the friction can wear through the cord's insulation, leading to arcing which can cause a fire. This is one reason AFCI breakers are recommended and/or required, as they can shut off a circuit at the first sign of arcing.
If you have to join two extension cords together (for a longer reach), make sure the cables are both the appropriate gauge to handle the extra length. To prevent the ends from coming partially or fully disconnected (which can be annoying, and a possible shock/fire hazard), tie a simple knot to hold the cables together.
Keep in mind that connecting too many cords together can be a fire hazard, and make sure you are using appropriately sized cables.
As an example if you want to use your circular saw at 100 ft., you'll need at least 12 AWG cable. If you need to reach an extra 50 ft. (150 ft. total) and happen to have an extra 50 ft. extension cord, both cords should be at least 10 AWG.