(CNN) — Anyone who's lost an evening researching flight deals knows that airfare pricing can seem pretty random -- high one week, low the next and long-distance often cheaper than short-haul.
There's a method behind the madness, though.
It's called airline revenue management: the science of adjusting fares dynamically and in real time so that airlines can maximize their revenue.
And it's not just a case of simple supply and demand.
Airlines now rely on ever-more sophisticated software that takes into account a broad range of factors, from overall conditions across their global networks, right down to the individual preferences of their passengers.
The evolution of airline pricing techniques
It hasn't always been like this.
For most of aviation history, airlines operated in a tightly regulated, uncompetitive environment, where air fares usually cost a small fortune.
Discounted tickets weren't unheard of, but usually came with lots of strings attached, such as having to spend a certain number of nights at the destination.
International routes were usually operated by the flag carriers of the countries involved, who would take a gentlemanly approach to competition and fare-setting.
Deregulation -- a global liberalization trend which began with the US Deregulation Act of 1978 -- swept everything before it, from the industry structure to the way we think about air travel and airline fares.
It's now all about revenue management, says Robert W. Mann, a consultant and former airline planning executive.
And that's something, he says, has become increasingly complex and fiercely competitive in the past few decades.
"The growth of the network airline and the drop in the cost of computing has brought revenue management to whole new levels of sophistication," he tells CNN.
"Techniques such as Expected Marginal Seat Revenue (EMSR) look at the best ways to optimize fares in real time, not only on a given route, but taking into account revenue-generating opportunities across the whole airline network".
This is why, for example, flying from London to Dubai may cost pretty much the same as flying all the way to Manila, also via Dubai.
That's because the airline may prefer to keep seats on the London-Dubai leg for higher-value passengers that fly longer onward journeys, and will use pricing to discourage those aiming to fly shorter trips.
Richard Quest meets the travel blogger attempting to reap the rewards of air miles without flying.
But how does the airline know who the higher-value passengers are and how much to charge them?
Stuart Barwood, founder of Travercial, an airline consultancy firm, says airlines can make a number of reasonable assumptions about the profile of traffic on a certain route and then adjust their prices accordingly.
"The London to Majorca route, for example, has a marked leisure profile. This has implications not only for fare levels but also for the way pricing changes over time.
"If the airline assumes that leisure passengers will tend to book relatively early, months before their holidays, it may be tempted to start pricing seats on that route relatively high. It would then adjust them according to the market response.
"Meanwhile on a typical business route -- let's say London to Frankfurt -- the airline may start with low prices to fill a minimum of capacity, then raise prices steeply for business travelers that book at the last minute."
In fact, those last-minute high-value passengers are so precious that some airlines go the extra mile to make room for them.
For example, a service developed by Barcelona-based company Caravelo helps airlines identify those passengers most likely to accept a flight swap in exchange for compensation, such as vouchers or frequent flier miles, and offers to rebook them on a later flight.
With space then cleared, the high-fare passengers are then booked onto the previously full flight.
Towards total customization
You might think of fare classes in terms of economy, business and first class, but the reality is airlines have dozens of subdivisions.
The airline will adjust the number of seats allocated to each fare class. When one class has been sold, the sale price will leap to the next one.
This is how most fares are currently set, but it's still some way off from the ultimate goal: Airlines want to know their clients so well they're able to offer fully personalized pricing.
Loyalty programs, registered users and cookie tracking can give airlines some valuable clues, but even when an airline has gathered a lot of data about its passengers they still might not be putting it to profitable use.
Adding up the extras
"In reality, it is quite common for passenger data to be scattered throughout several functional areas within an airline, kept in data silos where it is of little use to the revenue management department," says Barwood.
Airlines might be lagging behind the likes of Amazon when it comes to personalized marketing, but Barwood says many are getting up to speed with data management and this is already being felt in pricing and marketing.
Revenue management systems will increasingly take into account not only the air fare itself, but the total value a passenger can generate for the airline, including ancillary revenue.
That's all the extras that can be added to your base fare, and it's a growing source of profit.
Using seat choice as an example, many airlines now charge for the privilege of picking your seats in advance.
This could, in theory, be managed dynamically. Why not base seat prices on the occupancy of a given flight? Or charge less to members of your loyalty program?
This kind of profiling might be beneficial to the loyalty program customer in this instance, but what about when a frequent business traveler is then consistently shown higher fares when they're trying to book a family vacation?
It could well prompt a backlash among the sort of high value customers that every airline hopes to retain.
Protecting the brand
Richard Quest explores the tricky world of airline ticketing and the shortcuts available for cheaper fares.
And while airlines may have good reasons not to overcharge their best customers, they also have to be careful not to undercharge the other classes of client.
The temptation is to aggressively lower prices when there are still empty seats left before a flight departs -- but if this becomes the norm there's a serious risk of undermining the brand and alienating higher-value passengers.
A number of companies, such as Bidflyer, Plusgrade and SeatFrog, have come up with applications that allow airlines to sell upgrades to the highest bidder through an auction mechanism -- an efficient but anonymous way to get passengers to tell the airline how much they're willing to pay for premium services.
Back to basics
The apparent randomness of airfares makes for an excellent conversation topic with friends and colleagues, but it can also be a source of anxiety for many travelers.
Perceptions that prices are immensely variable can add to the fear that customers may be overcharged for any extras they inadvertently purchase, or the worry that they might not be getting the best deal out there.
Which is why many airlines have opted for a different approach: go back to basics and offer branded fares -- a bundle of services for a closed price.
This shouldn't be confused with the rigid fare system that prevailed when the first low-cost airlines hit the scene.
This is more like an evolution of the low-cost fare system which lets customers choose the extras they want to add to the base fare.
This approach means rebundling a bunch of services -- from checked-in luggage to a wider, more spacious seat --- into a number of fare package options of varying complexity, all selling for a set price.
Think of it as like the menu options at a fast food joint.
The airfare arms race
Airlines might have a whole battery of tools to help them extract the most revenue from their passengers, but travelers can also call on their own arsenal of technological countermeasures.
Companies such as Skyscanner and Kayak have introduced fare alerts which allow you to monitor fares for specific flights and get automated alerts the moment they change.
Some companies are also developing fare prediction technology that promises to help travelers book their flights at the optimal moment, when the fare is likely to be lower.
In order to do this they rely on their own algorithms, plus a heap of historical data on air fares.
California-based FLYR uses its own proprietary fare prediction technology to offer fare lock-in insurance in partnership with TripAdvisor.
This service is similar to buying a financial option where you pay a relatively small premium in advance, to make sure you won't pay more than a certain amount at a later date.
It also works with travel agents and other distribution partners to optimize bookings.
Seizing the moment
FLYR's founder, Dutch entrepreneur Alexander Mans, says that outside a 30-day window of a flight's date of departure, there is a 60 to 70% chance that a specific air fare will drop in price at some point.
"It is practically impossible for someone to monitor this manually, but with our computing resources we can predict pretty accurately the chances of a fare coming down and advise on the best course of action.
"If we think a fare is going to be lower in the future, we recommend waiting, before hitting the 'book' button."
Hopper is another company specializing in the field of airfare prediction. Its mobile app, which has been downloaded more than eight million times, uses big data technology to predict fares as much as 12 months in advance.
"Our system looks at six to eight billion air fares every day. Our database has five years of historical fares, that means trillions of prices!" Frederic Lalonde, Hopper's founder and CEO, declares proudly.
He claims their algorithms are capable of accurately predicting an airfare within $5, up to six months before departure.
"We are confident enough in our system to predict actual figures and to tell our customers whether they are getting a good fare or not.
"We have tracked our accuracy to 95%. Whether people later follow our advice or not is another story..."
With this amount of computing power being thrown into the field of airline pricing and the expectation that artificial intelligence technology will go mainstream, it might ultimately be up to the robots to fight the airfare war.
This isn't necessarily bad news -- it may result in better choices and more efficient booking processes.
With virtually millions of different air fares -- as many as the number of passengers airlines carry every year -- what seems assured is that airline fares will continue to be a topic of conversation by the office cooler for years to come.