Very generally speaking, traditionally user compiled and added programs got installed under /usr/local. With the proliferation of packaging formats like RPM and APT and their database backends which store the locations of files the packages install, this has become less the case and software packages are becoming more tightly integrated into the file structure.
That being said, it's not entirely obvious where things should be installed, though an attempt to standardize file locations was made in the early 90's. I'm not sure where it still stands, but a google search for 'common file structure unix' will give you several good introductions to the conventions.
In the mean time, get friendly with your package management system and know how to query what the file database.
For example, with RPM to know what package a file is part of do 'rpm -qf /path/to/file'. To find a list of all files in a package (installed) do 'rpm -ql package', or (not installed) 'rpm -qlp package.rpm'.