There is no way of doing this "easily".
While Joomla does collect all scripts and css before rendering them, a large number of extensions simply output the <script>
and <style>
tags in the markup.
So the only real solution is to write a system plugin that parses all the resources and performs the optimizations.
The best implementation you can find is toomanyfiles, which handles this correctly for css but not completely for js: the issue with js is that you can't simply move all js to the bottom: modernizr and other libraries affect the classes and need to be loaded in the head; and many libraries and frameworks (even bootstrap) have some methods that output markup directly, not to mention document.write()
: if this is your case, you'll have to discriminate manually.
You can get over 95% of what you need from it.
An honorable mention goes to JCH Optimize which is even less complete but follows a similar approach.