Think of a regular library. Whats it there for? So that you can go and look up information on a certain topic and not have to go out and do research someone else has already done.
So lets say you want to use a servo. Do you just hook it up to your mcu and and it knows what to do with it already? No.
Do you go and write all that detailed code that tells the mcu exactly what to do? No.
You use the library in which someone has already written the hard code and all you have to do is simple commands. You tell your compiler you want to use the servo library to do so and so with said servo. What really happens is when you compile your code, the compiler goes to the servo library and retrieves all that extra info it needs and throws it into the program to control that servo that someone has already written.
Hopefully that explains it.
Have you ever taken a programming class? If not, look up Stanford University's Programming Methodology Class on Youtube. Start on class 1 and work your way through. It is Java but it will give you a good base for further learning and the teacher is pretty interesting. You can also get the class schedule and example from Stanford's Website. Its all free!!