With the help of the Stack Overflow community I\'ve written a pretty basic-but fun physics simulator.
I found an excellent page with information on collision detection and response in 2D.
http://www.metanetsoftware.com/technique.html
They try to explain how it's done from an academic point of view. They start with the simple object-to-object collision detection, and move on to collision response and how to scale it up.
Edit: Updated link
You should use space partitioning to solve this problem.
Read up on Binary Space Partitioning and Quadtrees