Photography etiquette has three layers, legal, religious, and personal, and trouble usually comes from ignoring the second and third. Legally, most countries restrict photographing military installations, borders, some government buildings, and airports security areas, and a few extend restrictions further, which travel advisories flag. Religious sites set their own rules: many ban photography entirely inside, others ban flash or tripods, some prohibit photographing specific relics or the main sanctum, and ceremonies, funerals above all, are widely off-limits regardless of posted rules. Signage is usually clear, and where it is not, the absence of other cameras is your answer.
Photographing people is the layer where norms differ most. Asking permission is expected courtesy nearly everywhere, and in some cultures photographing strangers, women especially, without consent causes genuine offense or confrontation, while in tourist-saturated spots some subjects expect payment for posed photos, a transaction to settle before shooting. Children are the most sensitive subject worldwide, where asking a parent is the only acceptable route.
Habits that keep cameras welcome: gesture with the camera and a questioning look where language fails, accept refusals gracefully, photograph performances and crowds rather than individuals when unsure, put the camera away entirely during worship, and offer to show or send the photo, which converts many hesitations into smiles. The best travel photographs come from exactly the patience these courtesies require.