Short answer. Pedaling noise on an eBike is usually a worn chain, a loose crank arm, dry bottom bracket bearings, or a worn pedal bearing. All four are easy fixes on site if caught early.
Step by step
Locate the noise. Coast versus pedal. If the noise stops when you coast, it is the drivetrain. If it continues, it is bearings or the motor.
Check crank tightness. Loose crank arms click every pedal stroke. Retighten with a proper crank puller torque wrench.
Inspect the chain. A dry, stretched, or dirty chain squeaks and grinds. Clean, lube, and measure for wear.
Feel the bottom bracket. Grab both crank arms and push side to side. Any movement is a worn bottom bracket. On mid drive eBikes, this often means motor mount inspection.