There are various ways. A lot of sites are in fact online businesses, and make money as a shop might - eg, you order goods or services from the site, and pay for them as you would in a shop (though the method of payment can be different.)
Others charge users for using the site's services or accessing its information - Friends Reunited is an example of this. There, you can browse the site and leave your details for free, but you are charged a small sum for being connected with anyone else whose details you may have found.
An increasingly common way for sites to make money is through advertising. The site itself may be free to users, but if it is very popular, some large companies may be willing to pay to put advertising, pop-ups etc on the site. In this way everyone wins, as the users still get to visit the site for free and the site owners make money.
Others charge users for using the site's services or accessing its information - Friends Reunited is an example of this. There, you can browse the site and leave your details for free, but you are charged a small sum for being connected with anyone else whose details you may have found.
An increasingly common way for sites to make money is through advertising. The site itself may be free to users, but if it is very popular, some large companies may be willing to pay to put advertising, pop-ups etc on the site. In this way everyone wins, as the users still get to visit the site for free and the site owners make money.