In this circuit we used a variable resistor of 1k ohm ( pot ) and a 5V DC motor. As we know the DC motor speed is generally depends on the current provided to the motor. Here when we are changing the resistance of the pot so that the current provided to the motor also changes which will affect the speed of motor. You can change the i/p DC voltage if you want to use the motor having other ratings.
Circuit Diagram