Always ask before taking a photo - unless they won't know if you take it. That's not supposed to sound creepy, but sometimes you're say, taking a photo of the Eiffel Tower and someone happens to be in the shot, so that's fine.
NEVER pay money for a photo. It encourages begging, or harassment. Ask permission, and if they say no or want money for it, offer instead to send them a copy of the photo, or show them the photo and ask if that's ok. Thank them and move on. I realise this is a controversial one, but personally I'd feel really strange asking for money if someone wanted to take a photo of me, so I treat others how I'd want to be treated.
Susan Sontag who wrote "On Photography" (1977) had this to say:
"The camera doesn't rape or even possess, though it may presume,
intrude, trespass, distort, exploit, and, at the farthest reach of
metaphor, assassinate - all activities that, unlike the sexual push
and shove, can be conducted from a distance, and with some
detachment."
In most places, taking a photo in a public place is fine and you have the right to do so. It's in private places (homes, schools, gyms, workplaces) that you don't have the right and must have permission. However, what you DO with the public photos can affect your rights - for example, newspapers can publish news photos and don't need permission. However, try and sell a picture of a person on a photo website or similar, or use it in a book, and you'll need permission to use their image for commercial purpose.
Of course, how are you going to get permission from the awesome old Cambodian guy with the crazy beard that you got a travel photo of? Good question, and I've met several travel photographers who consider this a grey area and just risk it. But the key word there is "risk".