If a binary package or ebuild (gentoo) of a particular piece of software isn't available, or if you want to control the exact use of dependencies or other options, you may need to compile a piece of software "by hand". In fact, it's often quite easy to do. What complicates things is how software often requires that other software be already installed and available to it. The "README" or "INSTALL" notes for a particular package should talk about what "dependencies" it has if any.
So, in the simplest case, it's just a matter of unpacking the software, entering ("cd"-ing to) the main (or sometimes src) directory, and typing:
./configure make make install
The final step (make install) will often try to move files to somewhere where they can be "seen" by your system (like /usr/local/bin), so you probably need to do this step as "superuser". You can also "sudo make install" if you have the sudo command available.