The details depend on the exact trailer and, more importantly, on the bike.
There are lots of trailer couplers that simply go on the end of the rear axle and are clamped to the bike by the wheel bolt. But on an e-bike with a rear wheel motor, you might have a cable coming out of the axle on the side you want the trailer.
If you google images for "bike trailer adapter" you'll get a bunch of ideas for adapters you can buy, and if you look for "homemade bike trailer adapter" you'll get a bunch more ideas for workarounds you can use if a stock item won't work. Again, it depends on the bike and how much scratching or other damage you're willing to risk, but I see a bunch of pictures using hose clamps to attach something to the stays that a trailer coupler can then attach to.
We jury-rigged something on our cheap ebike many years ago: we didn't care about scratching and we figured it was pretty cheap steel but strong enough so we clamped the trailer coupler on with a U-bolt.
This is the best picture I can find of the bike with the coupler U-bolted to a seat stay: