While playing some airline management simulation games, I found all these checks to be some real kind of mess. If suppose I have a fleet of about 10 A-320s then if one them goes for any check, then I would end up losing about 10% of my earnings. How do real world airlines make up for these absent aircraft? Like, consider an A380. It takes more than 2 weeks for a C Check to complete (>1 month for a D-Check), and it certainly translates into a big financial loss. How do airlines operate such routes routes in the mean time?
Essentially they plan on some fraction of the fleet undergoing some sort of maintenance check at any one time, so they build their flying schedule around the remaining fraction. And then there is some amount of flex due to things needing unscheduled maintenance or coming out of maintenance early.
What makes the task easier is the fact that maintenance needs can be forecast fairly far in advance, and so the schedules can be built around a knowledge of how many aircraft are likely to be available.
As an illustration (not necessarily representative of any particular airline's actual numbers), let's say you have a fleet of 200 aircraft, and you know that on average each aircraft will be down for two 2-week heavy maintenance checks each year. That works out to essentially one month out of 12, each aircraft is down, or a little under 10% of the time. Add in a little time for shorter maintenance visits (but still longer than an overnight), plus an allowance for the fact that some aircraft just need unscheduled work, and the maintenance planners may end up telling you to plan on 175 aircraft available each day. So that's what you build your schedule around.
Now let's say that one aircraft takes a birdstrike & an engine needs to be changed. That is now a hole in the schedule. It can be covered by cancelling a flight (undesirable, but always an option). If an aircraft is finished with maintenance ahead of schedule (say it was scheduled down all day for some work, but the work is actually done by noon), that aircraft may be able to be put into service. Perhaps it's possible to delay some sort of minor maintenance a day (not a heavy check, but something quicker) and essentially create one aircraft-day of capacity, and push the check off to a weekend day when the schedule uses fewer aircraft. Or maybe the schedule was built with one or two aircraft available as spares that day.
Depending on a variety of factors, spares may or may not be available, or even deliberately built into the schedule at all. Having an A-380 sitting around unused all day is an EXPENSIVE insurance policy against something unforeseen happening, but cancelling a flight on something that big is an expensive event when it happens! If you operate all out of one giant hub and you know that your fleet of 500 aircraft (flying 450 lines every day) is likely to have 2-4 aircraft every day go to the hanger for unexpected maintenance, it's probably a good financial decision to allocate two or three of those lines as dedicated spares. If your aircraft operate a point-to-point schedule, it's harder (or unfeasible) to keep a spare aircraft at every airport you serve, "just in case" something happens to break there.
There are complicated decisions that airlines will continuously evaluate to find what balance works best for their particular operation. In some cases, it may be possible to substitute an aircraft from a different fleet for a broken jet... an MD80 goes to the hanger, and a 737 with a reserve crew flies the rest of the day that the MD80 would have flown. Or maybe a 757 broke, and the decision is to use the 737 to cover the flight, and re-accommodate the extra passengers that the 757 could hold that the 737 now can't. That's a tactical decision that the airline's operations center will make, considering the availability of both aircraft and crews, as well as the passenger loads. (They also may pull a "healthy" 757 off of its less full schedule to fly in place of the broke 757, use a 737 that wasn't going to be very full to cover that 757's route, put an RJ on the 737's route that day, and cancel the RJ's flights "due to maintenance." And if that inconveniences 4 flights of 40-50 people who mostly just get delayed a few hours, that's probably a better plan than stranding two flights of 200 people who'd otherwise have no way to get where they're going until tomorrow or later.)
In general, airlines plan the checks required for aircraft into their schedule. For example, if you have 10 aircraft, you can schedule the routes for only 8 aircraft, assuming that the remaining are in some form of scheduled checks. The bigger problem for airlines is when something unexpected happens, like there is a technical problem or an aircraft is unable to reach its source airport due to weather etc.
In such cases, the airliner can pull a spare plane available (usually only in cases of large airlines) or 'roll' the next plane available (from a later time slot, usually in another route), hoping that the aircraft will become serviceable in the meantime.
As others have mentioned, you don't use all your airplanes. You should plan to have some percentage of the fleet in heavy, scheduled maintenance and some other percentage of the feet as hot spares. The purpose of the hot spares is to cover unscheduled maintenance as it happens and to avoid short delays when a simple 1-2 hour fix is needed. The remainder of your fleet is what you use to build your schedule. Yes, this isn't optimal since a fraction of your fleet is never generating revenue, but that is how it works.
Same way you manage anything: with contingencies.
When your car insurance is up for renewal each year, do you suddenly go "oh crap I don't have enough money for this", or do you save it up over the year because you know it's coming?