I am happy to write letters of recommendations for my students. Here is some advice that could be useful if you are planning to ask me to do that.

I always base my letter on my direct experiences with the student.  You can certainly send me your CV, but most likely I will not use it for my letter. A consequence of this is that if you took a course of mine, but you didn't do anything beyond the minimal requirements then my letter of recommendation will be very short: it will include your results in the course with a comparison to the other students taking the class.

So what can you do to get a more detailed letter? Plan ahead! You can approach me at the beginning of the semester if you think you will need a letter of recommendation from me in the future, and we can figure out ways to strengthen your case. Or you could just make sure that you stand out in my class by doing additional work: e.g. solving bonus problems, doing extra reading assignments, or even working on a research project.

Another important advice is to ask me well in advance. If you are applying for graduate school then most programs will have deadlines in December and January. You should probably talk to me about your request by the end of October, just to be on the safe side.

Make sure that you are organized. Students usually apply to a handful of places, and I will need to know which programs you are planning to apply to. The best is to put together a spreadsheet with the program names and the deadlines.

Finally: after the whole application process is done, please let me know about the results! Filling out all the forms for your application takes time and energy, and hearing that you got into a great program is my reward.