Behaviour of using drupal_add_js
With drupal_add_js() you can set the scope to either header or footer, specify the group the script is loaded into, and give the script a weight relative to that group. Scripts are loaded by scope > group > weight, where a lower weight will be loaded before a higher weight.

If you have aggregation turned on in /admin/config/development/performance, the script will be combined with others with the same scope &amp; group, and ordered by weight.