Whom should you ask?
Follow any guidelines offered by the graduate program to which you are applying. Some prefer academic letters of recommendation and others prefer professional letters or invite a combination of letters. Think about who can speak most directly to the skills and qualities that will be needed for success in your typie of program. It may not always be the person who knows you best personally or seems the most approachable. Generally, character references from, for example, old family friends, are not helpful.
When should you ask?
Ask for your letters as far in advance as possible. Recommenders tend to be busy professionals, so please allow for at least 4-6 weeks' time for them to write your letter of recommendation.
How should you ask?
Be sure that anyone who writes on your behalf is happy and willing to do so. Phrase your request in such a way that, if someone does not feel comfortable writing for you, he/she can gracefully decline. Pressuring someone to write a letter of recommendation for you is not a good idea.
Letters of recommendation are most effective when they can describe you as well-suited to a particular goal. Politely, offer to have a conversation with your recommender or send them written materials so they can become familiar with you and your strengths, goals, and personal qualities. Sometimes alumni are hesitant to request a letter from someone who knew them from an experience 2-3 years ago. In our experience, recommenders are usually able to recall the experience and write a strong letter if appropriate.