Using first-principles calculations, we investigate the lattice dynamics of cubic and rhombohedral BaTiO3 and we discuss the origin of the structural instability of this ferroelectric material. First, we report results on the Born effective charges and the dielectric tensor and we emphasize the important reduction of these quantities in the ferroelectric phase. Then, the phonon frequencies at the Γ point are calculated. We point out the similarity of theoretical eigenvectors in the cubic and rhombohedral phases. We examine the interaction of the vibration modes with the electric field and in particular the giant LO-TO splitting of the ferroelectric mode. Finally, separating the dipole-dipole interaction from the remaining short-range forces, we quantify the balance of forces leading to an unstable phonon in the cubic phase and we demonstrate its sensitivity to tiny effective charge changes. Within our decomposition, the stabilization of the unstable mode in the rhombohedral phase is produced by a reduction of the Born effective charges, while its stabilization under isotropic pressure is associated with a modification of the short-range forces.