why is there a caste system in hinduism

A caste that is influential in trade, the Vaishyas were traditionally cattle-herders, agriculturalists, artisans and merchants. They are now associated with the middle-class and social advancement and make up around one fifth of India’s population.
Meaning “protector[s] of the gentle people,” Kshatriyas were traditionally the military class. They are now predominantly a land-owning caste and are diminished in power.

These are external links and will open in a new window
In recent years, there have been demands from several communities to be recognised as OBCs – in 2016 there were violent protests by the Jat community in Haryana and the Patel community led huge protests in Gujarat in 2015 demanding access to caste quotas.
The origin of the caste system is not known with certainty. Hindus maintain that the proliferation of the castes (jatis, literally “births”) was the result of intermarriage (which is prohibited in Hindu works on dharma), which led to the subdivision of the four classes, or varnas. Modern theorists, however, assume that castes arose from differences in family ritual practices, racial distinctions, and occupational differentiation and specialization. Scholars also doubt whether the simple varna system was ever more than a theoretical socioreligious ideal and have emphasized that the highly complex division of Hindu society into nearly 3,000 castes and subcastes was probably in place even in ancient times.
For many centuries certain Indian religious communities have been dedicated in whole or in part to the elimination of caste discrimination. Many have been guided by bhakti sentiments, including the Virashaivas, Sikhs, Kabir Panthis, Satnamis, and Ramnamis, all of whom bear a complicated relation to the greater Hindu fold. A major theme in bhakti poetry throughout India has been the ridicule of caste and the etiquette of ritual purity that relates to it. In North India this element is stronger among the bhakti poets who accept the concept of nirguna, which holds that brahman is to be characterized as without qualities, than among the poets who advocate the idea of saguna, which maintains that brahman possesses qualities. This tendency is not evident among bhakti poets of South India.

gk1415/hinduism ; Wikipedia article Wikipedia ; Oxford center of Hindu Studies ochs.org.uk ; Hindu Website hinduwebsite.com/hinduindex ; Hindu Gallery hindugallery.com ; Hindusim Today Image Gallery himalayanacademy.com ; Encyclopædia Britannica Online article britannica.com ; International Encyclopedia of Philosophy by Shyam Ranganathan, York University iep.utm.edu/hindu ; Vedic Hinduism SW Jamison and M Witzel, Harvard University people.fas.harvard.edu ; The Hindu Religion, Swami Vivekananda (1894), Wikisource ; Hinduism by Swami Nikhilananda, The Ramakrishna Mission .wikisource.org ; All About Hinduism by Swami Sivananda dlshq.org ; Advaita Vedanta Hinduism by Sangeetha Menon, International Encyclopedia of Philosophy (one of the non-Theistic school of Hindu philosophy) ; Journal of Hindu Studies, Oxford University Press academic.oup.com/jhs
Castes themselves, however, far from being abolished, have certain rights under Indian law. As described by anthropologist Owen M. Lynch and other scholars, in the expanding political arena caste groups are becoming more politicized and forced to compete with other interest groups for social and economic benefits. In the growing cities, traditional intercaste interdependencies are negligible.*
32 Dike, “The Caste System in Nigeria.”
“Untouchability” is reinforced by state allocation of resources and facilities; separate facilities are provided for separate caste-based neighborhoods. Dalits often receive the poorer of the two, if they receive any at all. In many villages, the state administration installs electricity, sanitation facilities, and water pumps in the upper-caste section, but neglects to do the same in the neighboring, segregated Dalit area. Basic amenities such as water taps and wells are also segregated, and medical facilities and the better, thatched-roof houses exist exclusively in the upper-caste colony. As revealed by the case study below on the earthquake in Gujarat, these same practices hold true even in times of great natural disaster.
References:
http://www.bbc.com/news/world-asia-india-35650616
http://www.britannica.com/topic/Hinduism/Castes
http://factsanddetails.com/india/Religion_Caste_Folk_Beliefs_Death/sub7_2b/entry-4158.html
http://www.hrw.org/reports/2001/globalcaste/caste0801-03.htm
http://afe.easia.columbia.edu/main_pop/kpct/kp_zhou.htm