How can I compare gear ratios on different wheel sizes? How can I compare gear ratios on MTB with tracking bikes with bigger wheels? How can I compare gear ratios with gear hubs?
Typically you quote gear sizes in gear inches, very basically this is the drive wheel diameter multiplied by the ratio between the two gear cogs, traditionally quoted in inches.
Also sometimes mentioned is development which is the amount of distance travelled by one revolution of the cranks (the astute will notice that is going to be proportional to gear inches and possibly a more meaningful quantity).
The more complex alternative, but one which is an absolute number, rather than measured in distance is Sheldon Brown's gain ratio which tries to include the crank length in the equation to get some sort of appreciation for the extra work for the smaller cranks found on, e.g., road bikes in comparison to ATBs. So for every unit travelled by the pedal on its circular journey, the bike will travel x units along the ground.
Hubs will still have an absolute number of sprockets, even if it is just an equivalence to a real cog so can still contribute to these equations.
The standard scheme is to convert gear ratio into "gear inches" (or, I suppose, in Europe "gear centimeters"). This goes back to the old "penny-farthing" bikes where to get a larger "gear ratio" you'd get a bike with a larger front wheel.
"Gear inches" is the diameter of a "direct drive" wheel that will travel, in one turn of the pedals, the same distance that a geared bike in a given gear will travel in one turn of the pedals.
You first calculate gear ratio, which is the number of front teeth divided by the number of rear teeth, then multiply that by wheel diameter. (Look up actual tire diameter on Sheldon Brown's web site, since rim "diameter" doesn't really measure anything.)
(Or there are no doubt several web sites that will do all this for you.)
To calculate gear inches for an internal geared hub you'd start with the fact that the vast majority of such hubs have their "fastest" gear be a "lock-up" where the wheel turns once for each turn of the sprocket. Then you calculate gear inches for that. If you then have the ratios of the other gears you can multiply/divide (as appropriate for the presentation of the ratios) to get gear inches for the other gears.
Whilst this doesn't expand further on the answers already given another site probably worth noting as it covers all of your examples with addition of direct comparisons, it's also very easy to understand is:
Unless you consider the crankarm length (which usually is NOT done for the sake of simplicity), you have one (or two, in the case of gear hubs) "multipliers" to get the ratio of speed (and torque) between the crank and the wheel, and one final conversion between angular speed and forward speed. That would either allow you to calculate forward speed for a given RPM, which is one of the best parameters to judge how a given gears "feels" on any bike.
First you have to calculate the gear ratio between chainring and cog. As an example from one of my bikes, if you have a 46t chainring and a 16t cog, dividing 46 by 16 gives you 2.875 which is a first multiplier.
Then, if I am in the 6th gear of my hub, the table from the manufacturer says it gives me a 0.528 REDUCTION ratio.
So, for every crank turn I have 2.875 times 0.528 = 1.518 wheel turns. If I know that my wheel has a circumference of 2.115 meters, then for each crank turn I'll go 3.21 meters forward.
Now if I take any other similar sized and similar weight bike and ride any other combination which gives me 3.21 meters per crank revolution, these gears most probably will feel very similar, and both bikes could be ridden side by side with the same cadence, even if one bike had a 20 inch wheel (that would mean the gear and hub ratio would have to be higher to compensate.
Although it is possible to calculate wheel circumference from wheel radius (radius * 2 * PI), the best way is to measure - with a tape - the actual distance travelled by the bike as you push it forward until the tire gives a whole turn.
Hope this helps!