Can anyone explain to me what the situation is with regards to protecting software?

If I develop software or a web application, can it be protected? I have heard that software cannot be patented, but then I know that sites such as Facebook are covered by patents.

Also, do you think it is possible to successfully start a new business, which is dependent on innovation, with open source principle - i.e. not protecting your innovation?