P3 =1 sets it to current control, where you get a different set constant current in each level, with small current on level 1 and max current on level 5. There is only the global speed limit on each level.
P3=0 sets it to speed control, where you get a different maximum speed in each level, with level 1 being a low speed and level 5 giving maximum speed. There is only the global maximum current on each level, so whatever level you're on, you get the maximum current as soon as you start to pedal.
The motor regulates the current independently from the controller. It will allow the maximum current up to a certain speed, then the maximum current you can get ramps down as the speed increases after that until you get zero current at the motor's maximum RPM.
The reason the motor has a max rpm is because it generates as soon as it starts to turn, and the generated voltage cancels voltage from the battery. At max rpm, the motor is generating 36v, so the net voltage is zero, so no current can flow.
Example:
Your controller allows 15 amps, the motor has a max speed of 260 RPM, you have a 36V battery and the motor windings have a resistance of 1.2 Ohms.
At zero RPM there is no generation. Ohms law says the current will be volts/resistance = 30 amps, which would burn the motor, but the controller limits the current to 15 amps by pulsing the voltage to make an average of 18v instead of allowing the maximum..
At 50% max RPM, the motor generates 18V, so net voltage is 36-18 =18volts. ohms law says the current will be 18/1.2 = 15 amps. Now you can see that regardless of RPM, you get a constant current up to 50% of the max RPM - always 15 amps
At max rpm, the voltage generated is 36v. Net voltage is 36-36=0V. without volts, no current can flow. What you can see in this case is that the current decreases above 50% max rpm. A 75% max RPM (195 rpm) the voltage generated will be 27V. Net voltage will be 9V and you'll get 7.5 amps.
These numbers are all made up and the explanation is simplified for the sake of understanding, but that's it in a nutshell.