The answer to this varies with the group that we are talking about. In general, groups vote one way or another because a given party is more closely aligned with their policy and/or ideological preferences. Let us look at some of the groups you have asked about and see how this applies.
Men and women. In general, men are more likely to vote Republican and women are more likely to vote Democrat. This is partly because men are attracted to the Republicans’ tougher attitudes on issues like crime, welfare, and foreign policy. Women tend to be more aligned with the Democrats’ preference for helping people and for trying to some degree to stay away from military intervention abroad. There are also specific issues of women’s rights where Republicans are less likely to support things like requiring companies to provide insurance that will pay for contraceptives.
Ethnic groups. In general, white people are more likely to vote Republican and non-whites to vote Democrat. Among Hispanics, this is driven in large part by the Republicans’ extremely hostile attitudes towards illegal immigrants. Both Hispanics and African Americans are more attracted to Democratic attitudes towards welfare and social services. They also tend to like Democrats’ less punitive attitudes towards crime and policing.
Religion. The more religious a person is (in terms of how often they go to church), the more likely they are to vote Republican. This is mostly because the Republicans are firmly in favor of traditional values. They are opposed to things like gay marriage and abortion. These are issues that matter to many religious people and so that group tends to vote Republican.
Economic class. Richer people are more likely to vote Republican, although this is somewhat mitigated by the fact that more educated people vote Democrat. Richer people tend to vote Republican because they like the GOP’s anti-tax stance.
Education. As mentioned above, more educated people tend to be Democrats. This is largely because they tend to be more liberal on social issues.
Thus, we can see that various groups are attracted to one party or the other largely because that party shares their values and leans their way on various issues.
People of different ethnicities have vastly diferent opinions on many topics because their difference in culture effects the ways they were raised and causes there to be a difference in the values and beliefs that are most important to them. This effects thsir lifestyles and their voting opinions. Also for difference in income, we all want what is best for us therefore rich people would vote for them to keep their money and not raise taxes while poor people would vote for raising taxes on the rich or decreasing taxes for the poor. Difference in education comes with how knowlegable you are on the subject of what you are voting for.