As NRG says. we have covered this in many ways at length so there are various threads covering all aspects. However, here is a summary of the major pros and cons:
REAR HUB MOTOR
Pros: Best hub-motor position for balance and steering, bicycles little affected by rear weight bias. Motor presence not obvious and with panniers can become a "stealth" e-bike. Short undisturbed cable from motor to controller and battery. Can use wireless cycle computers.
Cons: Have to use multi-sprocket freewheels to allow bicycle gears. These are not as strong as proper sprocket cassette systems and there's limited choice of sprockets available. Hub gears not possible either. Together with chain presence makes the rear wheel removal potentially difficult.
FRONT HUB MOTOR
Pros: Easiest to fit and to remove the wheel for maintenance etc. Good cooling. Any type of bike gears can be used, proper cassette based derailleurs, hub gears and even the NuVinci CVT. Two wheel drive on poor surfaces, motor on front wheel and pedalling traction at rear, cycling's equivalent of 4 x 4s.
Cons: Long cable to controller and battery which also is stressed by need to twist during steering. Motor size and weight can affect steering slightly in some circumstances. Motor presence can be more obvious. Motor electrics affect wireless cycle computers, so wired is best used.
CRANK DRIVE
Pros: Motor drives through the bicycle's gears so best use is made of the motor power and torque in any terrain. Can be integrated with bottom bracket and battery unit to make a single element system, waterproof and very quiet. Weight low down. Handling and steering unaffected. Motor unit, and battery if included, least exposed to road shocks. Any type of bicycle gears can be used.
Cons: The limitations of the power that a bike's gears can handle places an ultimate limit on the motor power. This doesn't affect legally powered bikes though. Crank drive systems are best as part of a bicycle's original design, add-on kit systems often have compromises on ground clearance, mounting and waterproofing.
.