How do developers make money from free or open source software?

I’m talking about good applications or web-based software like CMSs – how do they make money if the item is free or open source… How do they stop people ripping them off or taking the project in the wrong direction? what license should I get to make the most out of something I hope to write?