The fan comes on due to heat input. With the motor running the combustion process adds heat the radiator must remove. When you shut the engine off the coolant's forward flow does not stop instantly but the heat input does. As the engine is tinking and crackling sitting there it is running coolant through the radiator with natural convection since there are no check valves to stop it (only a thermostatic valve). This causes heat dissipation while it sits there for just a few seconds. Starting it back up the coolant is at a lower temperature so the fan won't start until the thermister in the coolant exceeds the temperature to close the circuit. Let is sit there at idle on a hot day and the fan will kick on in a few seconds.
For you scientific types the heat dissipation is based on the surface area of the radiator, the flow rate of the coolant, the differential temperature of the coolant to heat sink (atmosphere) and the specific heat capacity of the coolant. The formula is Q=mCpΔT. Heat Transfer (Q) is equal to mass flow rate (m) times specific heat capacity (Cp) time difference in temperture (ΔT)(heat source to heat sink). The Reynolds number for flow resistance in the radiator is ignored here because it gets way too complicated. (Trust Me)