There are advantages and drawbacks to each. For pure performance, ultra mid drive motors are the strongest ones out there. They offer exceptional torque and very precise electric control. They’re also the most expensive option out there. Bafang usually makes ultra mid-drive motors, and they’re a quality, well-trusted brand.
Mid drive motors are a step below ultra mid drives. They have a motor housed in between the pedals, and use the chain to propel the bike forwards. They have a lot more torque than hub motors, and are often of higher quality. They’re durable, but they’re at the forefront of most impacts on a trail, which means that they’ll often have a shorter lifespan than a hub motor. They also require maintenance and a precise chain-to-gear ratio. DIY bike builders often make the mistake of buying a mid-drive motor with the wrong ratio and can’t use all their gears, or in some cases destroy their bike.
Hub motors are the cheapest and easiest option out there. They’re usually waterproof, and you don’t have to worry about gear ratios or anything. They’re plug and play, and are the most used type of motor used in e-bike conversion kits. They’re a great option for a beginner, or for someone that wants to save a bit of money. Their downside is that they offer lower torque, meaning that hills are harder to climb. Most hub-motors are installed on the rear wheel for better torque and control.