Collective dynamics of vortices in trapped Bose-Einstein condensates