Always remove shoes before entering temples, mosques, and gurudwaras. Sometimes the boundary is obvious — there’s a shoe rack. Sometimes it’s not — the line where the marble floor begins. When in doubt, look at what everyone else is doing.
At gurudwaras, you’ll also need to cover your head; they usually have a bin of scarves near the entrance.
At mosques, shoulders and knees should be covered for both men and women.
At temples, the rules vary from relaxed to strict.
In homes, taking shoes off is common in South India;
Delhi is more flexible.
Observe first, ask if unsure.