As for the OP's questions (which are rather edition-agnostic, not sure why the thread's tagged '5e'):
I give xp for:
--- monsters defeated (which doesn't necessarily mean killed, talking your way past them counts too, but double-dipping by talking your way past them on the way in (and getting xp for that) then killing them on the way out is not going to work)
--- other hazards - traps, environment, etc. - defeated or avoided or rendered harmless
--- particularly creative thinking (the player does the thinking but the character gets the xp reward!)
--- the first time a character does something "big" related to its class, e.g. the first time a Cleric casts Commune or a Fighter deals a stupendous amount of damage on a crit, that sort of thing (these awards are usually kind of a token amount)
--- "dungeon bonus" at the end of each adventure (to in small part replace xp-for-gp, which I've never done)
--- things the adventure tells me to; for example, if the adventure says something like "the character who does this gets 500 xp" then so be it.
I track who gets xp for which encounters by little tick marks next to the character's name on a chart, where each column is a combat or encounter. I do the actual calculations whenever I think of it, either during a break in the session, or during the week, or if a player asks me to. Unless I've left it too long since the last time I did 'em, it doesn't usually take me very long.
I give out xp when it appears enough of a backlog has built up to make it worthwhile, and-or if I know someone is close to bumping. That said, I only give them out when the characters wake up in the morning. (ideally, every morning they'd get whatever xp they earned the previous day, but life's too short)