Are there any situations where it's preferable to put actions in the bottom bar rather than in the top one, or is it only based on the amount of space available for the buttons?
Our "unwritten" rule in our business (we develop mobile apps) is the top bar is generally reserved for app wide functions and the bottom bar is for page functions.
Obviously this is not set in stone and each situation is treated on its own merits.
The bottom bar (also known as split action bar) is used in the cases where you have too many items for your action bar and the UI space is limited.
EDIT: Do not forget that if you let the system handle the split action bar, it will hide it completely if all icons 'fit' in the topbar (usually in tablets and bigger screens)