Why are 'ghost flights' necessary? This article details the recent (March 2020) grounding of 90% of Ryanair's fleet due to the COVID-19 outbreak.


  Flight tracking data showed that all bar one of the jets had been flown in recent days: 35 had made loops of the airport, while the remaining 11 aircraft had operated a service at least once every four days.


Why are these flights required? The article states this is to keep the aircraft 'serviceable', but the airport I'm learning at has planes that haven't been in the air for months... if they are booked for a lesson, they get a service and away we go.

Why would a budget airline want to spend so much money on fuel and flight crew for these flights, when this could continue for months, it seems like it would make more sense to keep them grounded, and then service them all when this epidemic is over.
Airliners are both larger and more complex than the small aircraft you're familiar with at your local flight school. For an example of some of the items to consider, see: What do you need to do to bring a 737 Max back in service after 6 months in storage?

A lot of those things won't be improved just by flying the plane periodically, but some items are. Tires can develop flat spots from sitting for too long. Engines and systems need to have their fluids circulated. Getting things warmed up and moving helps to prevent corrosion. Even with proper storage procedures, an aircraft would have to be thoroughly checked for any foreign debris or damage that could have accumulated.

As the article you linked states:


  Planes that have been grounded for a significant period have to be checked over before they are cleared to fly again, a process that keeps them from flying for even longer and costs the airline money.


There is of course a tradeoff between paying to put the aircraft in long-term storage, and later to bring them back into service, versus keeping them in working order. Also, as mentioned in the answer to the linked question, the flight crew need to fly a minimum amount to be considered "current" and allowed to fly passengers. Even aside from regulations, having periodic practice will help to maintain skills for everyone involved.

Having crews do a few laps around the airport helps to keep both the airplane and crew in working order, and avoids having to do more rigorous checks to get them back up to speed when needed, which can save both time and money.