My bike has an electric motor that attaches to the rear wheel by way of its own chain and gearing system (sorry, I'm not a geek -- I bought it this way.) As CrimsonEclipse mentioned, there are kits you can attach to bikes in one of three ways: like mine, or by replacing the front or rear wheel with a hub motor, or a friction type that attaches to the tire. All of these are considered pedal-assist -- you still pedal but the motor can add speed or help you up hills. The more you pedal, the more range you get out of your battery.
I ride 17.5 miles one way over very hilly terrain (hills from 6 to 15%) on my commute. I've never run out of battery but that's because I pedal all the time. My motor only takes me up to 16 mph so I don't use it for speed -- I can achieve that on my own, at least on the flats. But it does help me up the hills which makes the ride shorter and more fun.
I'm awaiting delivery of a new sprocket that will increase the torque, though it will take even more off the top speed. But I've occasionally experienced thermal cutouts of the motor and I think the bigger gear will lessen the strain on it. Also, I have to zigzag up the 15% hill -- maybe I'll be able to go straight up.
I was just thinking about this the other day, and I did a bit of googling on the subject. There are a number of dodges (just do searches on bicycle engine or bicycle motor).
Honda makes a nice little unit that mounts on a luggage rack-type thing and runs the rear wheel with a roller. This is a pretty common set-up, apparently. The French used to sell a handlebar-mounted unit with a ceramic roller that pressed on the front wheel; there was even a lever that let you push harder should it rain and the wheel start to slip.
Another company builds a kit to convert a number of different 2 or 4-cycle weed-whacker engines to bike use through the use of a centrifigal clutch mechanism.
Yet another offers a chain-drive system that uses a proprietary cogset with a motorcycle-type cog in place of the lowest gear on the cogset. The motor can be mounted in several different locations.
All of these things offer extremely high gas mileage (4-500 mpg!) but with the penalty of extra weight and complexity. Note that the weight is usually rather high on the bike, and might present balance/handling problems.
Hehe- My LBS had a cute little Giant cruiser on the showroom floor with a 50cc two-stroke and a little teardrop gas tank. No front brake!
Yes, purists, I know..... But the tinkerer in me has the urge....