I had a long reply ready to post, hit the wrong key, and erased it!
Torque and RPM must be measured during an engine run, under load, at different speeds. Then, the figures are plugged into the formula to get Horsepower. The advantage to the desktop dyno program is that the engine doesn't have to be run, or even built, to estimate the performance. Just plug in the bore, stroke, compression ratio, camshaft specs, cylinder head design, etc., and the program computes the HP and torque output.
Low (numerically high) gear ratios, like a 4.56:1, for instance, give the engine a better mechanical advantage over the weight of the vehicle, and allow for quicker acceleration, and higher engine RPM for any specific road speed. Thyey're best for short-stroke engines that don't develop a lot of torque. Higher gears, like a 3.23:1, make for higher top speeds, but require an engine to have more torque to get the vehicle moving. Something in between allows for different performance options.
Jerry