I remember when we were young. We use to say “I bet that my school football team will beat your school team”. The other guy will say “it is a lie; my team is going to win”. We would say “Do you know I can bet with you and take your money? The other party will say it is also not true. Then you will ask (can we bet?). The guy will say yes, but the problem was that one party may not want to pay out at the end of the event. With the advent of the Internet, the Betting Exchange pioneered by Betfair came to become that middleman that would take our Bets (monies) and then pay out to the winner at the end of the event. That was how the betting exchange was born. And that is basically their function.
As you can see above, If you go to Betfair and you place a Back bet on an outcome as per any of the above prices, Betfair computers would immediately search for someone who has Layed the same outcome and then match both of you. This will happen remotely and the person matched with you may be at the other end of the world e.g. Australia. Your Bet may even be matched with multiple people who have Layed to march the value of your bet.
This is possible thanks to the Internet and with this Betfair changed the face of betting forever.
Betfair as the intermediary that takes the Bets will pay out at the end of the event. As middlemen, they collect a 5% commission on the winning amount. The loser does not pay anything. So that is what a betting exchange does.