I've been thinking lately that hosting a site with server-side user input must be extremely expensive/difficult. Take something like facebook for instance. They probably have petabytes of information stored on their servers, generated by users. Isn't this expensive? Can someone explain how this is done?
Yes its expensive, there are many strategies (mostly around scaling OUT, as opposed to scaling UP)
If you want to understand the architecture behind such sites, you may be able to find about them on this blog: highscalability
I believe there was an article on Facebook
There are numerous articles on Facebook on that site.
NoSQL databases may give you some insight on how they are doing this. David Thornley makes a great point about the Google hardware. Their biggest accomplishment may be their ability to manage tens of thousands of servers efficiently.
Some business models that offer free subscriptions have the most issues. If your next 1000 customers are paying a monthly fee, it's a lot easier to come up with the cash to buy more servers.