People may choose to move from rural areas to cities for a number of reasons, but the root motivation behind many of these causes has to do with the opportunities available in one's life. Here I will discuss a few different aspects of what might make city life more desirable than rural life for someone.
Work is an important part of life, and cities typically offer a greater variety of jobs and a larger work field in general. Work in rural areas tends to be limited to production of a local specialty (like agriculture or mining) and support for the people who produce it. In cities, there are a greater number of industries to work in. While rent (for comparable living arrangements) tends to be higher in cities, jobs in the city may pay better based on the type of work.
Without good health, there is not much left in life, so health is often a big factor in why someone may choose to move to a city. Though city air has higher concentrations of pollutants, city water is more closely regulated than rural water for contamination. People in the city also tend to live closer to physicians and have a greater variety of physicians to choose from. In much of the world, specialty care for certain diseases or conditions can only be found in the city. Treatment for or managing an illness may make it more effective in cost and time spent for an individual or their family to live in a city to be nearer their doctor or hospital. For many, just knowing that they live in a city with numerous general, emergency, and specialty care physicians is a benefit.
Many families and young people move to cities to further their education opportunities. Most cities have universities and community colleges where young adults gravitate and they may choose to move to the city permanently to facilitate their education and career. Families with children may seek education opportunities not available in rural areas. This includes general schooling and extracurricular activities like youth sports or science leagues, and exposure to cultural centers like museums and galleries.
Socialization also plays a factor for some people. If someone feels that there aren't enough opportunities for them to meet like-minded individuals, they may move to a city where they are more likely to find activities and socialization that meets their particular interests.