1.) Libraries can require other libraries, which makes the compiler sort the code accordingly. Because in wc3, directly calling functions lower than the execution line is not possible.
Scopes are nestable.
Structs are also a kind of encapsulated, organized code.
I practically only use structs. They also offer to call functions below by internally creating a copy of the function at the top. However, if this top function needs to call below again, it will transform into the execution/evaluation of preset triggers. Simply said, it is not as performant for the game if you do not pay attention to that. Libraries are commonly used to share code with other people and to indicate which packs of code they require.
I am currently writing a tool that remakes the function-sorting/trigger evaluation process of struct methods/plain jass. Then, the only thing that nags me is that structs are not directly nestable.
2.) Modules are textmacros designed for structs. You can implement them into different ones and they practically paste their lines. They may have some sort of an own encapsulation though. You can make an onInit method private and it won't get into conflict with another onInit method in the struct or private onInit methods of other implemented modules.
3.) Textmacros write/copy lines of code for you from a //! textmacro-block you have declared before. They are pretty weak though but at least, in contrast to modules, you can pass static parameters that can substitute placeholders in your template. Their disadvantage to modules is that they are not nestable.