Angels and pins

I have heard a lot about how Saint Thomas Aquinas wrote about how many angels could dance on the head of a pin, but I have no idea why he felt he needed to know this or what the good sir concluded.

Thank you dtilque, I should have thought to look in the archives first.