To get level ground speed, three main factors come into play. They're horsepower, drive reduction and weight.
Engines have a certain rpm where max horsepower is reached. 4 stroke RS, Honda engines, etc is generally around 7000 rpm. Depending upon the weight being moved will determine what the minimum reduction you can use and still be at max horsepower rpm. This will give you maximum speed. The heavier you and the bike are the greater the drive reduction needs to be, thus slower speed.
If you try to use too much of a minimum drive reduction what you get is engine strain. This is bad and will in time cause engine problems. A tachometer/hour counter is very helpful especially with shift kits. That way you are in the right gear where max throttle also puts you in max horsepower rpm. The hour counter helps with oil change and air filter cleaning schedules.
Bottom line is the lighter you and the bike are the less drive reduction you need so the faster you'll go.
If you can't reduce weight any then horsepower (bigger engine and/or performance parts) needs to be used to reduce drive reduction.
With small 4 strokes where max horsepower is reached around 7000 rpm a reduction drive of 13.53:1 needs to be used to obtain 40 mph on 26" wheels.
With China girl kits where max horsepower is reached around 6000 rpm a reduction drive of 11.6:1 needs to be used to obtain speeds up to 40 mph using 26" wheels.
Realistically this isn't going to happen using a small engine unless the bike and rider total weight is around 200 lbs or less. Otherwise you're going to need more horsepower to run a reduction that small to obtain 40 mph.
A more realistic goal would be 30 mph. For the small 4 strokes at 7000 rpm max hp you need a reduction of 18:1 using 26" wheels. The China girl kits where max rpm hp is 6000 you need a reduction drive of 15.46:1 using 26"wheels.