Dogman gives great advice. Not sure if I can add to it.
I think you need to rethink speed. 40mph is really fast on a bicycle. Lots of guys are doing it, but it requires a lot of thinking and planning. 30mph is about the upper limit of 48-volt, and to go faster will eat up the gas, so-to-speak.
Obviously, like gasoline, speed affects range. Like in a car, you can go 95mph down a Montana highway, but your gas millage will be horrible. Electric bikes are similar.
For your amount of money (a thousand dollars) you can build a fine electric bicycle that will last you for years and years. If you want 30mph and a 20 mile range, your budget is perfectly reasonable.
I'll offer my advice (but I'm not an expert. I'm just someone who has learned a lot over the last three years, but Dogman and others are far more experienced and have a greater education in physics, electricity, and mechanics.
1. Choose your bike wisely. Really think about what kind of riding you want to do. City riding, gravel trails, grass, hopping curbs, dirt, mud. There are many types of riding. Clearly, a road bike made electric will be very fast and efficient, but won't do well on grass, sand, etc. A mountain bike with thick, wide tires will handle all terrain well, but won't be as fast (friction of times, etc.).
If you are commuting mostly, I'd recommend going for comfort. I have a Trek Pure (very similar to Electra Townies), and it's about the most comfortable ebike I can imagine. I had mine wired up for a while and really enjoyed riding it that way (the kit is now on another bike).
2. Consider a kit from America, be it Canada or the U.S. You'll get excellent support from Ebike.ca or ebikekit.com. Both are outstanding companies who are very responsive. You CAN get all parts you need much cheaper by ordering from China (a lot of people use Cellman from ES whose website is emissions-free.com). I don't have experience ordering from him, but I've heard nothing but positive reviews. His batteries are pricey, but no more so than others of equal quality. His motor kits are inexpensive, however.
I would consider a complete kit from one of the three, because that way you have everything you need at one time to get it done right.
Ebikekit.com and Ebike.ca offer complete kits, as does emissions-free. They can all provide what you need for a good price. My favorite is EbikeKit.com, because Jason (the owner) has been extremely responsive to my emails (never failed to get back to me promptly). I've purchased two kits from him.
There are other vendors as well.
3. Don't rush into your purchase. Take time to learn before spending money so you don't have regrets or have to spend more than you thought you'd need.
Here's my recommended setup:
2. This motor kit (watts are actually determined by amps x volts. Motors are rated for a certain wattage, but they aren't extremely limited).
http://em3ev.com/store/index.php?route=product/product&path=36&product_id=54 $235
3. This battery pack: http://em3ev.com/store/index.php?route=product/product&path=35&product_id=106
And you'll have a nice setup that will go about 30mph at top speed and keep you going for 20 miles easily, maybe more if you pedal a bit.
Good luck.