Bill Gates and Mayor Michael R. Bloomberg said they would spend $500 million to stop people from smoking.