It's not necessary that they are currently profitable to have received investment.
The reasoning behind the funding goes that, if a service is popular and has gained traction, a business model can be implemented later. This is particularly common amongst internet services with a strong network effect.
For this type of business, the purpose of the investment is primarily to allow it to scale, and survive through the early days while there is little or no revenue coming in. The goal is to 'get big fast', and gain widespread adoption. This is particularly important for network-effect services, as the value of the service to each individual user scales with the number of users on the service as a whole.
If a competitor came along and grew faster, it would encourage your users to switch (as the competitive service, being more pervasive, would be more valuable), and this loss of users would further drive down your relative value, and so on. Result: when you add value by being bigger, you need to try and be the biggest. Symmetrically, by growing big fast, you add significant barriers for any potential competitors.
Joel talks about this in his first strategy letter, with specific reference to Amazon.
There's more to explain though, because Amazon has a pretty clear revenue stream. Why grow big and own the whole market of a free service? The reason is that popular services are thought to be easy to monetise.
Revenue streams for these types of businesses include:
There's an article here suggesting 10 ways to make instagram profitable.
By having an exit strategy, such as being bought out by Facebook.