Note that it won't be a range extender if you use the ICE to charge the motor's battery, because you'll be using up some of your gas range to do that, and you will not get anywhere near the range from the battery that you used up putting that range in there.
If you want a range extender, you need to have a completely separate power source to run the motor that can supply all that range. that can be a separate generator running on gas (from a separate tank than your existing engine uses) that charges a small battery to run the motor, or a large battery that supplies all the range itself.
Motorcycles aren't typically all that aerodynamic to start with, and whatever you use to carry the battery or generator on there will likely not help that, and so will decrease your range from that as well. You can build fairings that will help with that (Vetter, etc).
This will all be more complicated, heavy, and expensive than simply having a second gas tank on there to extend the range of your ICE, if you are outside the easy reach of a gas station.
If your main goal is not range extension, but just additional traction / climbing power, then as long as all the extra weight of the motor, controller, and battery don't rquire so much power to drag up the hills that it's more than they can produce, and also still have enough extra to help you up the hill as much as you want, it could be worth adding.
You can use various calculators / simulators around the web such as those at ebikes.ca to see how much power it will take to do what you want, including the additional weight of the motor/battery/etc (probably at least another 100lbs, depending on battery capacity and capability required).
If range extension is not an issue, but the traction is, you can use a bigger "generator" that your regular engine runs (the coil referred to above), to charge the battery as you go, but you won't want to be running that charge process while using the extra-traction-motor, because it will load down your engine and sap drive power from it that you need.
A motorcycle-class hubmotor requires it's axle to be clamped into your dropouts, so you will have to modify your fork to be capable of this. It's axle doens't come out like a wheel axle, so if your fork doesn't have removable axle clamp tips already, you'll have to build some for it to allow you to install the motor into it.
Additionally, the motor will twist it's axle back and forth druing acceleration and regen braking, unlike a wheel axle. If you are using telescoping suspension (the most common type), this will wiggle your fork lowers against hte stanchions (or vice-versa depending on fork design), and might cause binding of the suspension under those conditions (won't matter when the motor is not being used, just when torque is applied), so the suspension might be less functional or inactive if the torque is high enough.