The segments (or multi-segment routes) are each assigned a value in the fare basis. The ticketing carrier issues the ticket and collects the revenue. They then use ARC - the inter-airline accounting system - to reconcile the debts that they owe each other for the flights.