Generally speaking, the compiler doesn't know where to find
much of anything on its own. The compiler deals exclusively
with one file at a time.
The linker is normally responsible for putting all the object
files together into an executable. When the compiler produces
the object files, they have external references -- i.e.
references to things that weren't defined in that file. The
linker tries to find definitions in the other files to satisfy
those external references.
In the case of a template, the linker may find that the
correct template exists, but has not been instantiated over
the correct type. Assuming it supports export, the linker will
then do something like re-invoking the compiler, directing it
to instantiate the template over a specified type. The
compiler does that, then the linker continues, with at least
that external reference satisfied.
That's one solution, but a compiler could also use some sort of
"implicit include"---CFront more or less did, although it did so
at link time, reinvoking the compiler with special options, and
Sun CC supported it for a long time (and maybe still does). All
it takes is a naming convention, so the compiler can find the
corresponding source file.
From the point of view of the standard, the difference with
export is that the implementation file is compiled in its own
separate context---nothing you can put in the client source can
affect names not looked up using dependent look-up. The larger
the project, the more important this becomes.
And although the standard doesn't say anything about this (the
standard doesn't even require separate compilation), the one
existing implementation will only recompile one file which uses
the template if the implementation is modified, rather than all,
as is the case otherwise. This can make a significant
difference in compile times during the development cycle if the
template is not yet stable---make a small change in one function
in the template to correct an error, and you only recompile one
of files in your test suite, rather than the entire test suite.