On the Frequency Control of Energy Storages: A Unified Analysis and Design