I don't plan on applying to graduate school until 2014 so I have not gone through that part yet, but I intend on being more proactive in building relationships with my professors in the next two years so that asking for LOR would be a little less stressful.
The only time I've had to worry about recommendation letters was when I need them to apply for study abroad. I wasn't even close to the professors I asked. When I came to them to ask for a LOR I provided them with my personal statement, reminded them who I was (I was shocked they remembered and liked me.lol) and told them when I needed them. They were really accommodating.
For grad school it would be a little different though because a really good letter requires more commitment (time wise) and needs to be more personal. The letter writer needs to be able to make a compelling case on your behalf and
speak about your academic credibility. If you don't have personal connections to your potential letter writers, you still have a chance at getting a decent letter. Professors and advisors expect to be asked for LOR. They probably have templates or something.
When asking for one I would approach them in person, tell them why you'd like them to write your letter (suck up a bit, remind them who you are if it's been a while), let them know what you're applying for, provide/offer them with your personal statement, and let them know when your app is due. If they agree to do it, you may have to stay on top of them for time. That's why it's best to ask well before you need it.
Oh and thanks
You're awesome too!