Regarding Case Fans

I have built a pc before, but for some reason I find that I have a very vague idea of installing case fans. I would like to know more about molex connectors, fan controllers, and basically just how to install case fans. With my first pc build, I simply connected the fans to the motherboard and this stopped my pc from booting because the case had an internal fan controller. It was basically fixed through trial and error but I would like a set of clear instructions for my next build. Thanks