Electronic Structure and Localized States at Carbon Nanotube Tips