Depends totally on your bike's Battery Management System and what options it offers.
Generally speaking, a battery has a certain amount of stored energy, which is its capacity in watt-hours, which may be expressed in amp-hours (at a known voltage).
Functionally, a battery could put out energy at half the maximum rate, for twice as long. If your bike's BMS lets you choose a lower level of assist, then it will get you further on a charge.
Excessive speed also costs you in power - at 15 km/h roughly 10% of your power goes into aerodynamic drag, with the bulk as rolling resistance and friction. At 40 km/h your rolling resistance power loss remains about the same in terms of watts, but the aero losses are now 75-80% of your power usage. So you're using 5× as much power to cover the same distance, at 3× the speed. (figures are for a road bike; it's worse for a less aero bike)
If your bike has a throttle and not pedal assistance, then get it up to a safe riding speed and stop using the throttle. Pedal to keep it at that speed, only use the motor to accelerate or to climb hills.
Remember in the end it's an assistance system, not a replacement for pedalling. If you're treating it like an electric motorbike, then start pedalling and that will extend your range incredibly.
Most modern e-bikes have a range indicator. This tells you how many kilometers you can cover with your current battery charge. Depending on the manufacturer, this is either by means of a direct mileage indicator on the display or LED lights on the bike. FIT e-bikes have the practical Geo-Range function, which you can use with the FIT E-Bike App. This shows you on a map how far your e-bike will take you with the remaining battery capacity at the various assistance levels. The app is available from both the App Store and the Google Play Store.
Want to know more about e-bike batteries? Find out more in this blog post or click on the button for an overview of the advantages of FIT batteries:
Advantages of FIT batteries