Here's little more in depth break down on SeaFoam:
Added to Fuel Tank - it cleans the lines of varnish, water, moisture. It disolves and/or absorbs the above and carries it through to the cylinders where it's burned off as exhaust
Added to oil - It adds detergent (similar to detergent/cleaning agents in regular motor oil) to keep all bearing surfaces & oil galleries from accumulating dirt & corrosion. It also works on carbon buildup in cylinders (mildly) and valves.
Added directly - (via vac line or intake at full strength) It's a "shock treatment" to carbon buildup. The key when adding directly is to allow it to sit 15-30 mins, it gives time to disolve carbon build-up. If you run motor immediately you run the risk of "chunks" of carbon breaking off and gouging or scouring cylinders/valves. Also if you don't let it stand 15-30 mins you're just wasting the majority of the product.