Most major airlines utilize codesharing agreements as part of overarching partnerships and alliances. On a codeshare flight, two or more airlines offer a flight under their own flight number and each sell seats, however the actual flight is only operated by one airline. Airlines must have an agreement to do this. You can’t just book a flight on a budget airline and hope to show up and take a different premium airline traveling to the same destination.
Book codeshare flights like you’d book any ticket. Just search through your preferred portal, select your dates, times and ideal airline (paying attention to that fine print) and pay. Often times, you can also pay with miles for flights on other airlines through these partnerships, though some airlines may have rules against this.
No matter how you booked, the airline operating the flight is the one you’ll check in with. From the example earlier, even though you purchased through United, you’ll check in with ANA, and every step of the process, including the plane, will be through ANA. Only, you’ll earn miles with United, and pay for your fare directly to United rather than ANA.
Other ways codeshares operate are on multi-leg journeys where you fly one segment on one airline, and during a layover, switch to a second airline for the next leg. Both of these segments will be ticketed as one flight ticket, issued by one airline who is a codeshare partner with the second. This is a popular option when flying to a smaller city through a larger hub.
For example, you might book a flight from New York to Nice, France on Virgin Atlantic. The leg from New York to London is operated by Virgin, but a codeshare with Delta. You could choose to earn miles on Delta, if it’s an airline you flight more often. From London, neither Delta nor Virgin fly to Nice, but their partner British Airways does. All segments and airlines would be ticketed together and purchased as one, despite technically spanning three airlines.