You have tables that let you work out the maximum cruise altitude for the weight you are at. The most efficient cruise altitude is a bit below this. These days, computer databases maintain an updated wind pattern for pretty much the whole Earth surface (the bits that count), and this is factored in so that sometimes it is better to stay lower and in a strong tailwind or avoiding a headwind- this is common ex Bangkok/Singapore to Europe flying westwards over north India- often it's better to stay below 28 or 30,000' for many hours after take-off to avoid higher headwinds higher up. Usually now it's computer flight plans that determine optimum cruise altitudes- it's not just a question of flying as high as possible. Getting yourself into a Jet Stream is always worth while- sometimes it's worth flying further to do so, but they can be very broad and deep indeed, so it's the computer flight planning machine that works out the optimum route and altitude. It also takes into account navigation charges- it can be worth flying further to avoid expensive countries!