Most people ask what are modules in ZF2. Well this is a fairly good question. So I'll try to explain it in my why. Modules in ZF2 are set of class(es) grouped together to perform a single task and a single task alone and do it well plus let other perform some extra if they want.
Now the question arises that what does single task means and what is some extra work. So lets keep our focus on single task at the moment and sit back and relax. Now lets think of a small task first. The smallest that I can think of is adding google tracking code. Now the question arises that what sort of a stupid task is that. I can add it manually on the footer of a page big deal. Cool enough, agreed. Let think of it in a broader way.
Now assume yourself that you're working within a team and you were assigned a task to add google tracking code to a site and the code is maintained via git repository. You've pushed the code to the repository. Also you've reported to your team lead that you've done the task. Your code first gets pushed to development environment than staging than live site. What will happen the code gets replicated to all three sites where as the tracking code only needs to be visible on live site. Not a big deal. I'll use if condition to check if its live site or not. Agreed on that to. Let think of it one step further.
Now assume you've 3 different layouts and you've performed the same repeat of code on the 3 layouts. Now its a replica of same code on three layout. Now you would probably say that I'll put the code in a file and include it. Good enough. But you can't do that in ZF2. For even a small task like adding a google code ZF2 says that make a module. Now with that module you can plug and place it in any application and have fun.
Last but not the least what did I meant when I said do it well plus let other perform some extra work if they want. For the time being lets become a cook. Let say you've grilled a chicken and served it to a customer. The customer took it home and pore some lemon juice on top of it some onion and extra salt for his liking and ate it. The next customer added some gravy on it and ate it and so on and so forth.
Now you see that you as a cook just cooked a grilled chicken but customers added flavors to their liking. In the same way modules can and can't have option to add flavors on top of the code to make it more useful for his/her liking. But as for adding google code that doesn't require any special thing to be added you will just keep it as is. But for a module like adding a user to your site should have something like that.
I'll discuss about adding flavors to a modules, when I'll talk about ZfcUser the best module to get started with zend framework.