Under what circumstances is there a conflict of interest for a researcher to be a reviewer of a submitted academic paper? If I were asked to review a paper,
under what circumstances would I be expected to decline out of a conflict of interest?
Could I review a paper for someone...


I have collaborated with N years ago?
Who I am currently collaborating with, but we have not yet published a paper together?
Who is currently or was once in the same institution as I?
The answer to your question depends on context.  I find three key elements to the decision of whether or not to declare conflict of interest:


Formal rules: some venues have an explicit conflict of interest policy; if so, abide by it.
Size of reviewer pool: sometimes, you have an extremely specialized subject, in which the number of people qualified to review a paper at all are quite small.  In such a case, one should generally be more permissive.
Formality of venue: conflict of interest for a journal or top conference is generally more strict than for less formal venues like workshops, especially for ones intended to discuss early-stage work where all you're really looking for is a sanity check.


Now, to address some specifics:


I generally hold that it's a bad idea to review one's current or recent collaborators except in the most informal of venues.  
Co-authors is often the same as one's collaborators, but not always --- one might be collaborating but not yet be published together, or might be a very distant co-author (for example, I'm not going to worry about conflict of interest with most of the co-authors on my 600+ author paper).  
I also don't generally count co-organization as collaboration, since that's often a fairly narrow relationship.
Being at the same institution (currently or in the recent past) may or may not be a conflict depending on how close the organization is: in some places different departments might as well be different institutions; in others, it's one tight family.
Being funded by an organization is almost certainly a conflict of interest.