Thanks for using NextGEN Gallery Optimizer!
Unfortunately, it's not currently possible in WordPress to detect if a widget or do_shortcode() call (which processes shortcodes in themes and custom fields outside of the post content) is actually present before the head section of a page is loaded (re: Optimizer's FAQ). By the time they're discovered, it's too late to load the required scripts in the header (where they need to be to avoid breakage), and since the aim of Optimizer is to not load unnecessary scripts and styles on every page, this continues to be a work in progress.
That said, I've recently come up with a solution whereby if you tell Optimizer which pages you want your scripts to load on, it will both insert them conditionally in the head where they won't break, and only on the pages you specify (not sitewide).
If you could provide some more information (and maybe a link) about where you require the scripts to load (eg. homepage only, all Pages, posts by id or category) and the functionality (eg. slideshows, Fancybox or both), I'll write you a custom function that can be incorporated into Optimizer to accommodate this more advanced usage.
Hope this helps!