In the case of Stack Overflow, users under 200 rep (and by extension anyone not logged in) sees more adverts. SO gets a huge number of page views from search engines and the majority of those will be new, unregistered users.
With the traffic SO gets, it's incredibly easy to make a lot of money, even via Google Adsense. But SO makes more money by selling its ad space directly. Jeff Atwood has a great post on the matter.
SO also makes money through its careers service and job postings.
Everyone has a different pricing model. Websites like Quora, Twitter, and Stack Overflow starts as free websites and get funded from donations or venture capitalists or some are present there for promote the parent company.
You can take the example of ShareThis sharing buttons which is made only for promothing the parent company. Similary, blogger.com is used to promote Google. Delicious to Yahoo, Bebo to AOL and lots more.