Gears are not necessary on an electric bike, but many riders prefer the control gears provide during the riding experience. However, the number of gears an electric bike needs will depend on the intended use of the bike. The gear shifter on an electric bike is on the handlebars, not the motor. An electric bike motor does not power the gears, it only powers the throttle and the pedal-assist. (source: [Electric Ride Owner](https://electricrideowner.com/electric-bike-gears/), [Discerning Cyclist](https://discerningcyclist.com/do-electric-bikes-have-gears/))
If you are one to take your bike on short rides on flat roads, you may not need any gear for your electric bike. But if you want your electric bike to go on more terrain, you would want gears installed on your electric bike.
Most riders prefer to have gears in their electric bikes for the bike to still be able to endure other terrains. A pedal assist-only electric bike would not be strong enough to climb uphill roads which would be so much easy to climb with gears.
There is also the battery capacity of the electric bike. With gears, riders could extend the battery of the e-bike and could utilize the pedal-assist system much longer.