How to turn a brushed DC Motor into a generator?
kuttadmi is right, you basically just spin the shaft with some external force and electric potential (voltage) is created along the wires that normally supply power to the motor. It is fairly simple to get power, but these motors were not designed to do this and it is not easy or efficient to get a lot of power this way. Since the motors are usually intended to run at a relatively high rpm, you would have to spin it very fast to get a large voltage and the timing of the internal magnets and coils is set up to generate torque on the shaft not generate power, so you might lose some efficiency there. But don’t let that dissuade you, if you have one sitting around, do some experiments and see what you can get.