How do airlines provide crews for the return leg of a long-haul flight?
You presume that they flew back the very same day... but that is an incorrect presumption. 

For long flights over about 8 hours, strict rest limits apply so they cannot fly again for 8-10 hours at a bare minimum. Typically, a crew from a long-haul flight will stay in a hotel in the destination city for anywhere from 12 to 48 hours, depending on the flight length, timezone changes, airline schedules, union contracts, and so on. Yes the hotels and travel bonuses costs the airline a pretty penny but that's the cost of doing business. 

So at this very moment there will be 1 or maybe 2 LX crews, resting (or touristing...) in San Francisco, waiting to fly a return service. 

For more information you can google or ask a new question on Fatigue Risk Management Systems.