I guess the title said it all. How do I know when to link a .lib or .a file to dev-c++. I guess my question also applies to the #include command also. Is it based on what commands I give the file (I assume so), but how do I know what I need to #include and link?
When you are just using the standard library, you shouldn't need to link anything. Your #includes are based on what functions you are using - for example, if you use std::string, you should include the <string> header, if you use std::strcmp, you should include the <cstring> header, etc.
If you are using a third-party library, however, follow the instructions in the documentation on what you should link. For example, if you are using GLFW (A basic windowing system for use with OpenGL) you should link to libglfw3.a, as well as things like libopengl32.a. As I said, read the documentation.