What are fifth freedom flights?
Fifth freedom flights are flights between two countries flown by an airline from a third country. In other words, Airline X from Country A operates fifth freedom flights between Country B and Country C, with the flights originating from Country A. Airline X has the rights to transport passengers and cargo solely between Country B and C, these rights are also called "Fifth Freedom Rights". Thus, these are fifth freedom flights.
Singapore Airlines 26 from Singapore to New York-JFK has a stop in Frankfurt. It has rights to transport passengers/cargo solely between Frankfurt and New York-JFK, meaning passengers can book the Frankfurt-JFK sector only without continuing to Singapore, thus it's a fifth freedom flight.
What if Airline X stops at Country B before continuing to Country C for technical purposes and does not disembark/board passengers?
Fifth freedom flights should not be confused with second freedom flights. Second freedom flights are flights with second freedom rights, which allow an airline the right to stop for maintenance or fuel without disembarking passengers or cargo.
Royal Jordanian 184 from Amman to Jakarta has a stop in Kuala Lumpur. It does not have rights to transport passengers/cargo solely between Kuala Lumpur and Jakarta, meaning passengers cannot book the Kuala Lumpur-Jakarta sector without continuing to Amman, thus it's not a fifth freedom flight, and in this case, a second freedom flight.
What if Airline X stops at City Z in Country B before continuing to City Y in Country B/flies between two points in a country?
These are not fifth freedom flights as the stopover point and the destination are in the same country. On these flights, airlines are usually not allowed to transport transport passengers and cargo solely between the two points of the foreign country. The stopover is usually for technical purposes.
Qantas 11 from Sydney to New York-JFK has a stop in Los Angeles. It does not have rights to transport passengers/cargo solely between LAX and JFK, meaning passengers cannot book the LAX-JFK sector without continuing to Sydney, thus it's not a fifth freedom flight.