This paper addresses the allocation of Energy Storage Systems (ESSs) in power grids by finding the optimal number of ESSs and their locations and sizes with the goal of improving reliability in contingency states. We propose a contingency-sensitivity-based heuristic to decide the optimal number of ESSs and the most effective locations for ESSs support, while circumventing the combinatorial nature of the siting problem. A contingency sensitivity index (CSI) is proposed which represents the impacts of contingencies on the network buses. The CSI ranks the buses, such that those with higher impacts have the privilege for installing ESSs. For the ESSs being fixed, the sizing is formulated as a multi-period AC optimal power flow (OPF) problem and solved by Self-Organizing Hierarchical Particle Swarm Optimization with Time Varying Acceleration Coefficients (HPSO TVAC). The optimal ESSs sizes are selected by minimizing a total cost, which includes investment cost of storage devices, bus voltage deviation cost and average network losses cost. Uncertainties of the renewable generation are accounted by considering different realizations of the generation profiles, then, ESSs sizes are selected by taking the worst case approach. The proposed methodology has been demonstrated on the modified IEEE 30-bus system and Tunisian Grid. The obtained results show the effectiveness of the proposed methodology and the related reliability merits.