How to hook up a fan to this switching circuit
You connect the fan between "12V out" and ground.

Q2 is configured as a switchable current sink.  With 5 V on its base, its emitter will be at about 4.3 V.  That causes 1 mA thru R2.  Most of that will come from the collector, which in turn means it comes from the base of Q1.  That current being drawn out of the base of Q1 turns it on.  That switches the "12V out" line high.  Its voltage will be the 12 V input voltage minus the C-E drop of Q1.  For a saturated transistor without excessive current, that is usually around 200 mV.

You should check that the 2N3906 can handle the fan current.