The role of energy and entropy in the electrical double layer