Battery discharge when not being used.

Why do batteries when stored in the item that it is used in whether it is a light, camera or whatever go flat quicker than if it were stored separately from the item and why do some discharge quicker, eg, from one brand of light etc to the next. There is a name for it but I'm not sure what it is. Thanks.

Parasitic drain?

Yep, that sounds like it with a quick Google search. Why and how does this occur when the item using the battery is not turned on?

Its all down to the Drain Fairy... TBH I assume there are several different reasons, some cell related, some driver related. I've always taken it as a fact of life and never worried too much about the light related causes.

When a cell loses power over time, that's called self-discharge. The cells preferred around here are the LSD, or Low Self-Discharge. Lithium-based cells are inherently LSD

When a cell loses power at a faster rate than the self-discharge rate, it is due to parasitic drain or standby current consumption.

This can happen for several reasons. One would be an electronic switch requiring voltage to operate, another would be corrosion or galvanic action making a short.