There seems to be some confusions regarding terminology here.....
All electric motors can create energy by being forced to turn, mechanically, or can be fed energy from a battery to make it turn..
example, the alternator in your car is an electric motor, the gas motor is forcing it to spin at X rpm creating a certain voltage that recharges your 12v lead acid battery in the process...
In the same way, a direct drive hub motor, powered by a battery and controller, has a max rpm depending on the voltage of the battery.
More voltage = higher rpm
So lets say that a bike with a hub motor on 36v goes 20mph on the flats at full throttle... you keep the throttle on full and roll down a big hill where the bike goes over 20mph, by going down the hill faster than the max rpm of the motor at 36 battery volts, the motor generates higher voltage because it's forced to spin faster by the hill and your momentum, at a certain point you will be producing energy from the motor that can be fed back into the battery and increase the battery voltage and put energy back into the pack...
That exists right now with most hub systems... right out of the box.
However...
With the right electronics, you can rig a switch that disconects the battery from the controller, and makes use of the energy produced by the motor while on the downhill right down to 0 rpm and you can do one of 2 things with this energy, either run it thru a big resistor to turn it into heat ( Resistive Braking ) or feed it into electronics that can step up the voltage and feed the battery pack ( Regenerative Braking )
confused yet ?
All that said, unless you roll up and down severe mountains, most places on earth will not produce any meaningfull enery from all this, it can be usefull to bring you to a stop saving on brake pads, but regen to charge your battery pack typically only delivers a few small percent points back of usable power because you have to factor in the losses in those electronics on top of the added weight and complexity of the system....... just not worth it right now until someone makes a plug and play solution for it and i don't know of any readily available right now.
I have had the opertunity to ride Justin L's ( ebikes.ca ) ebike that he crossed canada with, something like 6000 kms for 8$ of electricity ( he left vancouver BC, and i'm in Moncton NB, so coast to coast ) .. he made his own controller, it has means of using the throttle as a variable adjust braking system, you pull a brake lever attached to a wire ( not a brake cable, but an electric wire ) that turns the throttle into a brake lever by causing resistance in the motor according to how much you twist.... really cool and very smooth !!!