I always see questions from developers trying to understand how the files are resolved. As an AEM developer this is the first thing we all should understand. You may end up in a complex architecture if you develop components and templates with out understanding this concept properly.
Please find the exact explanation of the same here [SLING-387] Simplify script paths and names - ASF JIRA
This is be very useful for any beginner to understand the sling resolution clearly.
Good one veena