Should I send a thank you email immediately, or perhaps wait a day or more? Does it make a difference if its a phone interview or an in person interview? If you wait too long, then it is likely to have no effect, or even seem out of place. However, if you send it right away, it takes away one of the advantages, which is that it reminds them of your strengths.
Emails should generally be sent within a day or two. Exception being if your interview was on a friday, try to send one by EOD, or an hour or two after opening on monday. Lots of times, over the weekend, people get flooded with emails, and won't always want to read them all if they're not urgent. Waiting until the recipient(s) have settled down, gotten through their morning routine, and will notice a new email appear is somewhat courteous. If you're sending a paper letter as thank-you, put it in the mail the next day. Make sure you date it in formal style, so they'll tell when you sent it.
It is a good thing when you have an excuse to contact them by phone or email. Sometimes they need a list of references, or an electronic copy of the resume.
While you are sending the email turn it into a thank you email. You should send it within 24 hours. I try for close of business for a morning interview, and by early the next business day for an afternoon interview.
I would wait about 1/2 a day. It's a good idea to draft it immediately after the interview while ideas are fresh, but it's also a good idea to then put it aside for a few hours, maybe sleep on it, and then review it for both content and tone and send it.
I would have a minimum of 4 hours to not be (or seem) rushed and a maximum of 3 days while you are still current in folks minds and they are still deciding- which can vary (a lot) by industry and technology from minutes to months (e.g. startup to government) so adjust accordingly.
If the decision is being made right away, such as even the very next day, it is imperative that the thank you note arrives right away. This is often the case with teacher interviews. Send them the same day as your interview for snail mail, so hopefully they will arrive the next day before the decision is made. Send on the same day for email responses too, waiting several hours. Even if the decision is already made, a nicely written thank you note will keep you in the running for the next posting.