It is a matter of when you need the code to be executed.
If you are going to manipulate the DOM tree (e.g. move elements around/ show-hide etc) and you put your code in the head of your document, your elements will not be there when your code is executed, therefore your code will not work.
In that case you can put your code in the head of your document and invoke it when the document DOM is ready, with $(document).ready()
Putting code at the end of your document is rarely necessary, one occasion I can think of is google plus +1 button, that requires you to place a script after the last +1 button, so you just stick it to the end of your document to be sure.