Environment variables are often used to store a list of paths of where to search for executables, libraries, and so on. Examples are $PATH and  $LD_LIBRARY_PATH, which will typically resemble this:
PATH=/usr/bin;/bin LD_LIBRARY_PATH=/usr/lib;/lib
This means that whenever the shell has to execute an application (binary or script), it will first look in /usr/bin and then search /bin.
When building and installing a program from source, we often need to add custom paths for the new executable and libraries. For example, we might install myapp in /opt/myapp, with binaries in a /opt/myapp/bin folder and libraries in /opt/myapp/lib.