Only drink the bottled water that can be found in supermarkets and grocery stores. When you are in a restaurant you should specifically ask for bottled water. Try to avoid drinks cooled with ice cubes as these may have been made of tap water. Ask for drinks cooled in a fridge instead.
If you want to live in India and don't want to go through the hassle of buying water bottles every day, you can install water filter systems in your house.
Although many westerners think that they know Indian food from restaurants at home, there are major differences between that and the real thing.
If you have stomach issues you should choose your dishes with care. Even though trying real Indian food is an important part of experiencing the Indian culture there are some dishes that will definitely cause problems. You should just slowly acclimate your body to Indian cuisine.
When you go out to eat you should pick your restaurant carefully. Note that there is a wide range of restaurants in India: some of them cook and serve food right on the street, whereas others have ultra-modern kitchens and dining areas. Keep in mind that the cleanest restaurants do not necessarily offer the safest food. They might use pre-prepared ingredients from suppliers with dubious hygienic standards. Therefore, food cooked right in front of your eyes is the safest option.
Some restaurants (and especially small cafés) serve their food on plastic plates that are not thrown away after use but instead “cleaned” with a dirty rope. Check each café's practices before eating there and, if necessary, demand a new plate. Other restaurants offer fresh banana leaves as plates which are thrown away after they have been used. These are a nice alternative to plastic tableware.