See the Python documentation for Modules.
Specifically, scroll down to the section entitled “The Module Search Path” and “Compiled Python Files”.
( Although the information for locating modules is for Python 2.6, I believe the same information applies to Python 2.5 at Python 2.5.4 Modules Documentation )