I'm assuming that you've got an NPN transistor with the emitter grounded and the fan between the collector and V+

A transistor has current gain (check the datasheet for the transistor for HFE) Often you see a range, say 80 to 400 -- take the smallest value.

The fan requires a certain current. Let's assume it's 0.25A. Round it up to 0.3A.

Divide the fan current by the gain figure (0.3A / 80) = 3.75mA Just for luck, double this (it's not really for luck, we want to make sure the transistor is saturated).

So we need a base current of around 8mA.

the high voltage from an arduino is around 5V, Vbe is around 0.7V, so we need a resistor that will drop 4.3 volts at 8mA.

From ohms law we get 4.3/0.008 = 537 ohms. I'd grab the next lowest resistor value, 470 ohms.

But it works without a resistor, right? That's because the Arduino has only a limited current drive and that current is small enough not to damage the transistor, so it's generally pretty happy.

Once you fit a 470 ohm resistor*, check that the transistor isn't getting significantly warmer than it was before. If it is, reduce the resistor value. It's possible that the fan takes more current than you estimated.

*Note -- 470 ohms may not be the right value for you. Follow the steps and substitute appropriate values.

The datasheet may also indicate base current required for saturation at several collector currents. This will also provide a guide to the base current you may require. If the saturation figures are available, check your calculated base current for reasonableness.

You should be able to follow the math, If you want more explanation about anything else, please ask.