How fast can an ebike go? How much power is needed? on the flat  or up a hill
To start with you need to understand the difference between torque and power.
Some people think torque is power. It is not. Torque is the turning force making, or trying to make, something rotate.
Power is the rate at which that torque is doing useful work. That is power equals torque times speed.
Similarly powered motors can have low torque and high speed or high torque and low speed.
A motor will have a maximum speed that it can go, even if there is no load on it.
Similarly, for any slope of hill there is a maximum speed that the motor can go.
I will show how to work these out using a Golden Motor Mini Pie as an example.
(they also call this Smart Pie or Magic Pie 4, or MP4)
It is a good "in between" motor  between the light 250 watt motor and the heavy 500 watt motor.
The performance data for the Golden Motor Smart Pie is tabulated here
and using that data I drew this very rough graph. 
You can see from the performance data that under no load (like if the wheel is off the ground)
the motor won't go any faster than 281 rpm. That is 35.4 kmh if it is in a 26" wheel.
If you get on the bike and go there will be wind and rolling resistance as you go faster.
The motor has to produce torque, and thus power, to overcome that resistance.
To pro
duce the torque the motor speed will be slower, and as more torque is required the motor will slow more.
After the the energy is spent to accelerate and the speed is steady all the power is used overcoming wind and rolling resistance.
The wind resistance is larger and greatly increases at with increasing speed – approximately with the square of the speed.
The rolling resistance is smaller and is proportional to the speed.
It depends on the bike, its tyres and wheels, and the smoothness of the road.
A graph of these forces (Watts W) versus speed (kmh) would look like this...
(it's very approximate – because I haven’t got access to a wind tunnel) for a rider in a sitting upright position.
If you are on a road bike and are tucked down the wind resistance will be much less at any speed.
That will mean you go faster, but for this exercise for want of more accurate data I will use the above guessed graph.
Assume weight of bike and rider is 100kg and that it is a 26" bike, with 36v battery and on full throttle,
and no extra pedaling assistance from the rider.
The process of estimating the bike speed is a circular process. First I guess an answer and use that to get an answer,
and use that answer to refine the original guess.
First Example  flat road
I'll start by estimating the maximum speed on a flat road. I'll guess 29kmh.
From the graph the wind + rolling resistance is 235 watts.
Watts W = Torque T x radians per second
Torque units are NewtonMetres but it is just an intermediary measure
From that equation : T = W x 1.8 x D / kmh where D is wheel diameter (M)
In this case : T = 235 x 1.8 x 0.66 / 29 = 9.63 NM
From the motor performance data 9.63 NM torque is produced at 231 rpm
kmh = rpm x pi x D x 60 /1000 = rpm x D / 5.24
in this case kmh = 231 x 0.66 / 5.24 = 29.1 kmh
That's close to the original guess, and thus is the estimated flat road speed,
but if it was different I'd replace the guess with that result and repeat the process.
The power output is 231 watts and power taken for battery is 295 watts and efficiency is
still close to maximum at 80%. In example below note that the power used when going
maximum speed on a flat road is only 2/3 of power used when going maximum speed on a hill.
Going Uphill
Now, if I ride up hill I have to overcome gravity, and the power required for that is proportional
to the slope of the hill and to my speed.
The torque required is proportional only to the slope.
T = G x Kg x % x 0.5xD where G is gravitational constant 9.81 M/sec/sec
T = 4.9 x Kg x % x D
Example 2 2% slope
I'll estimate the maximum speed for a 2% slope.
Guess 27 kmh, at which w + r resistance is 205 watts and torque required to overcome that is
T1 = 205 x 1.8 x 066/27 = 9.02 NM
Torque required to overcome gravity is
T2 = 4.9 x 100 x 0.02 x 0.66 = 6.47 NM
Total torque required T = 15.49 NM
which is produced when rpm = 203 or at 203 x 0.66 / 5.24 = 25.6 kmh
Repeat calculation at kmh a little above that, say 25.8 kmh
T1 = 190 x 1.8 x 0.66 / 25.8 = 8.75
T2 = 6.47 NM as before
T = 15.22 NM which is produced at rpm = 205 or at 205 x 0.66 / 5.24 = 25.8 kmh
Power output is now close to maximum at 325 watts and power input is up to 445 watts
and efficiency has dropped to 75% .
Now I'll repeat the process for different slopes
Example 3 3% slope
Guess 23 kmh
T1 = 170 x 1.8 x 0.66 /23 = 8.78 NM
T2 =4.9 x 3 x .66 = 9.70 NM
T= 18.48 NM which is produced at rpm = 183 or at 183 x 0.66 / 5.24 = 23.05 kmh  near enough
Power output has reached its maximum of 354 watts and power from battery has increased
to 515 watts and efficiency is down to 71%.
Note that power output is 50% more than when going maximum speed on a flat road.
Example 4 4% slope
Guess 20 kmh
T1 = 128 x 1.8 x 0.66 / 20 = 7.60 NM
T2 = 4.9 x 4 x 0.66 = 12.94 NM
T = 20.54 NM which is produced at rpm = 164 or at 164 x 0.66 / 5.24 = 20.65 kmh
The right answer would be a little less, probably 20.5 kmh
Power output is staying close to maximum at 353 watts and power from battery has increased
to 535 watts and efficiency has dropped to 67%.
Note that power taken from battery is now 80% more than power used when going
at maximum speed of 29 kmh on a flat road.
The distance covered on a charge will be much less when there are hills on the trip.
Example 5 6% slope
Guess 14 kmh
T1 = 78 x 1.8 x 0.66 / 14 = 6.62 NM
T2 = 4.9 x 6 x 0.66 = 19.40 NM
T = 26 NM which is produced at rpm = 103 or at 103 x 0.66 / 5.24 = 13.0 kmh
13.1 kmh would probably be about right if recalculated
Power output has dropped to 280 watts but power from battery has increased to maximum 550 watts
and efficiency has dropped to 52%. The motor is now using almost twice the power used
when travelling at less than half the speed compared with maximum speed on the flat road.
At this 6% slope the motor is struggling and running inefficiently. That is by itself, without assistance from the rider.
At slopes steeper than this the motor is increasingly more inefficient and will stall.
If the rider makes enough pedal effort to keep the bike speed above about 15 kmh the motor will be "happier".
One final note : the motor data is made with a input voltage of 36 volts. Batteries operate in 4042 volt range.
Therefore the power output could be 1015% higher.
