Why Planets Have Rings