Sneak damage can be applied to both ranged and non-ranged touch attack spells as long as you have a class that grants sneak attack damage.
For sneak damage to apply your character must be in a 180 degree arc behind the target as the spell fires (not when you start casting!). For ranged spells you also need to be in sneak range (30 feet/approx 9 meters).
The target must be unaware of the caster for the spell to apply sneak damage. Silent Spell really helps here.
Damage is applied as the same base type as the spell in the case of elemental spells. In the case of draining, death type spells the damage is negative energy. In all other cases the damage type is magical.
Epic Precision allows half damage to be applied to sneak immune targets.