I wouldn't put references in a resume. I also would not leave in anything to the effect of "references available upon request". It's not uncommon for companies to ask for contact information for managers, supervisors, or coworkers from previous jobs at some point in the process, but there's no need to include any of that information on a resume. Use a resume for exactly what it is intended to be used for, which is to provide an overview of your education, experiences, and knowledge to a potential employer.
As far as reaching out to potential references, if you are actively looking for a new job, you should reach out to people early. Let them know you are in the process of looking for a new job and ask if they are willing to be a reference. If they are willing, they should provide their most recent contact information that's appropriate. Keep this information until a company you are applying to asks for it.
In terms of who to ask, most places I've seen expect you to provide contact information for your immediate supervisor during your job. If your immediate supervisor is not available, then someone that you worked closely with. I've never seen a company ask for references from places that were not considered employment (as an example, volunteer opportunities or open source contributions), with the exception of a character reference (who can be someone that you know personally but have never worked with).