I've read conflicting suggestions which make sense from different angles. I think it depends more on the design of the fan.
A spinning fan blade is going to effectively 'throw' air down the length of the blade as it turns, due to the viscosity of air. This is similar to the annular discharge of a turbo compressor (but a lesser effect, obviously). With a fan that has no curve or 'winglets' at the tip of the blades, the air can definitely do this - different tip designs will mitigate this to different degrees (notice most electric fans have swept blades). This can help increase fan flow though, especially at lower fan speeds. Especially since the engine is right behind the fan and blocks airflow to an extent.
A fan completely buried in a shroud could be slightly less effective because of turbulence able to get behind the blades - but it would depend on the design of the shroud. If it was a simple barrel shaped shroud with no 'collector' over the core area, then it should probably be as close to the rad as possible. But with the type that covers the core area, having the fan protrude too far into that common space could cause the tip turbulence to reduce flow behind the blades and reduce flow potential.
A shroud should also fit very tight to the tips of the blades - ducted fan research has proven this and shows substantial gains with a reduction of tip clearance. The challenge is ensuring the engine doesn't move too much and eat the shroud!
In all cases, higher fan speed will help cooling. This is where
@yellow rose's talk about overdriving the water pump always makes a lot of sense to me... at least in theory ;)
One of these days I'll get around to swapping in my probe fans - then I can be as cool as
@j par