How do pilots decide what their cruising altitude will be?
As has been stated, ATC will assign you an altitude, taking into account your requested altitude, traffic conditions, and of course the FAR.

Peter's formulas will apply from a design standpoint. The aircraft designer will use something like that to calculate typical values, which will be included in the aircraft's operating handbook.

The table below is listed by pressure altitude and gross weight. At each combination there will be performance values such as:


Average N1 (for a turbine)
Max TAT for thrust rating
IAS Knots
Mach number
ISA fuel flow LB/HR/ENG
ISA TAS Knots


The flight distance will determine the approximate gross weight, which corresponds to an altitude and cruise speed that provide the best efficiency. Here is an example from a virtual 737 handbook, with the values I listed. The optimum performance is in blue. Higher gross weights have been removed for clarity.



Airlines may have their own performance tables, choosing a custom balance of efficiency and speed. Dispatchers for the airline will take the flight information and decide on a cruising altitude for filing the flight plan, which the pilot will then receive. As you can see, as the aircraft burns fuel and gets lighter, it will be more efficient at higher altitudes. This is the step climb that Peter mentioned, where the aircraft will climb to higher altitudes as the flight progresses when they are cleared by ATC.

Modern planning systems can take into account weather factors such as winds aloft and turbulence to pick the most efficient route.