Modules are a special Cake component designed to augment, change or replace the internal logic of Cake itself. Modules can be used, for example, to replace the built-in Cake build log, process runner or tool locator, just to name a few. Internally, this is how Cake manages its "moving parts", but you can also load modules as part of running your build script, which will allow you to replace/change how Cake works as part of your build code.
Currently, the most comprehensive resource available is the following video from Alistair Chapman walking through the process of building a new Cake module from scratch. The full video is available on YouTube.