It's all controlled by the Routing table, very much like a normal router. The table will hold three kinds of routes:
1. Static Routes, that the operator has configured to tell the PC specific routing information. This includes default routes, which are special types of Static routes, which tell the kernel something like "If you can't find a better place to send this traffic, send it out of interface X";
2. Connected routes, which are the directly connected networks. Obviously if a packet is destined for address a.b.c.d/24 and network a.b.c.0/24 is connected on interface Eth0, then that packet will be sent out of that interface;
3. Dynamic Routes. These are less common, because you must be running something like Quagga, a routing process which communicates with routers in the network and adds routes to the routing table according to information gathered.
Have a look at
http://linux.die.net/man/8/route for the "Route" command, and this page:
http://www.cyberciti.biz/faq/what-is-a-routing-table/ gives even more details.
Hope this helps!