The overwhelming majority of people you meet in your travels in India will not want to do you any physical harm. A few might want to part you from some of your money by overcharging or conning you. A few might be offensive, overly curious, or insensitive. Many will be extremely friendly, helpful, and well intentioned. In short, the people are probably a lot like those in your own country.
In India you do need to be careful of petty theft and minor scams but incidents of violence directed at travelers and snatch-and-grab crimes like purse or camera snatching are rare. (Gold chain snatching is frequently reported in urban papers, but this won't target foreign travelers. Indian women wearing the traditional marriage necklace are the victims)
What you are more likely to encounter, besides the inevitable auto rickshaw driver demanding a higher fare, are stealth crimes (a bag disappears on the train, a hand sneaks into a backpack) or some kind of scam (a friendly stranger offers to arrange a ticket and disappears with the money). You should maintain the same kind of awareness and watchfulness you employ in your own country. If a situation doesn't seem right, or you don't feel safe, take precautions. Be careful, but don't be paranoid.
Most times in India there will be a lot of people around. This can be sometimes annoying, but it also offers security. Passers-by will usually be quick to offer assistance if they sense you are having a problem. If you do encounter a threat in India it will most likely be in an isolated spot. Beaches at night are a classic problem area, especially near cities. They tend to be deserted except for bored young men from the city who may hang out there a recipe for trouble.
Similarly, tourist spots which are largely deserted have lately been a source of problems. The sprawling ruins of Hampi, for one, have had a few incidents, though the police are usually quick to take preventative action especially where foreign tourists are involved.
India has its share of scam artists. (Here we are discussing minor scams that might affect travelers, not the major ones where politicians get caught with fingers in the State cookie jar.) These vary from an autorickshaw driver or a fruit seller overcharging you, to serious con artists who will attempt to part you from your money or possessions. Places where foreigners come in large numbers tend to offer the most problems. Delhi is infamous for scamsters. Here is a small sampling of some common scams:
That hotel is no good. You catch a taxi or auto to a hotel that's been recommended. On the way, your driver informs you that the hotel is closed, or no good anymore, and suggests a "better" hotel. Better for him, of course, as they pay a commission. Stick to your original plan.
The friendly ticket taker. You are approached in the station by a Ticket Inspector, complete with clipboard and black jacket. He helps you find your train, gets you aboard, and warns you about thieves. Once he's gone you may find your camera is missing, or your tickets are gone. Genuine Ticket Inspectors are very busy people, and will not have time to help individual travelers. Decline offers for help.
The helpless refugee. You are approached, often at the main Post Office, by someone speaking very good English. The conversation is general, but it is gradually revealed that the poor gentlemen has recently run into a touch of bad luck, perhaps he's a refugee, or was recently unfairly fired. Nothing, of course, that a few dollars wouldn't alleviate. It is probably just a high class pan-handle. Your generous donation would probably be better applied to a legitimate charity.
The common denominator is generally that you are approached and offered help or drawn into conversation. When you find that someone is going seriously out of their way to help you out, it pays to wonder why. Be friendly, but a bit suspicious, and don't be afraid to decline the assistance. If the other person is persistent, then you should assume there is more in it for him than for you.
Indian society has a strong tradition of politeness to strangers, to women, and to the elderly. Unfortunately, as in many Western countries, this traditional politeness has been eroded over the years, much to the dismay of most Indians. Indian papers occasionally report incidents of harassment of young Indian women. This is usually cat-calling and suggestive behavior indulged in by young men and is quaintly referred to as "Eve Teasing". Indian women also may experience incidents of groping on public transit.
Western travelers are not immune. In fact, there is a commonly held view that Westerners, particularly women, have loose morals. This view has developed from exposure to Western media, from contact with insensitive Western travelers, and from the huge contrast between what is acceptable dress or behavior in India and that in the West. As a rule, the more touristy a place is, the more poorly behaved some locals might be.
Prevention is important
Preventing situations from developing in the first place is important. Dressing and behaving appropriately helps a lot. Do not promote undue familiarity, especially if you are a woman. Indian women keep a good distance from men who are strangers. Touching, even hand shaking, is inappropriate. ("Namaste", with palms pressed in front of you is the most appropriate greeting if you want to maintain distance.) Indian women would not sit close to a man they don't know. Nor would they entertain idle conversation with a stranger. Not keeping this distance would be offering a mixed message.
Do not wait until someone has stepped over the bounds considered inappropriate in your country. Instead, judge actions by what is proper in India. If you find that some man is being overly friendly, making physical contact, or generally being even slightly improper, be on guard immediately. It is much easier to politely deflect an incident or distance yourself in the early stages than when things have gone too far.
Sometimes a polite warning is refused, or someone does something inappropriate without warning. What then? If possible, try not to over react. Determined action is always more effective. If you cannot get your point across politely but firmly, then be rude if necessary. And don't be afraid to alert bystanders that you are having a problem. But do not get physical.
Avoiding Physical Action
Physical action is usually not appropriate. Violence is frowned on in India, in part because it can very easily get out of hand. If you should see an altercation between Indians, it would consist mainly of a great deal of shouting, insults, and angry hand gestures. People would rarely come to blows, or even push or shove. Usually, friends or bystanders will intervene and gradually the whole thing dies down.
Physical action - shoving, punching, or throwing something - can create a lot of problems, beyond the obvious one that someone's friends will rally and kick your ass. You could end up with the police, and possibly have a case filed against you. It will put a real crimp in your trip. Better to swallow your anger, remove your ego from the scene, and try and extricate yourself quickly from the situation non-violently.