So many questions. Sounds like you need to study the oracle documentation.
How does it know where to look for an ear? Either you told it where to look by configuring a new application in the console or in development mode only, you dropped ear in autodeploy directory and it knows to look for ears etc there.
config.xml is created when the domain is created. It is loaded when the server starts up.
Do not edit it (unless you know what you are doing and have shut down the server and backed everything up; even then it is rarely necessary). Changes to config.xml are made when changes are made in the console.