Build something like open atrium
You're going to want to understand the relationship between Organic Groups, Spaces, Context, Features and possibility the Persistent URL and Strongarm modules. Aside from Organic Groups, they were all created by the same developer who started Open Atrium.

Here is one very basic run-through about how Open Atrium works.

Here is a description of how each of those modules factor into the OA structure.

Be warned: I don't think I've seen a more complex site built with Drupal. Most of those modules are not only complex, but also genius.