I'm going to put up all sorts of flashy warning lights here, because this is where I messed up in undergrad so I'm unduly conscious of this mistake. The first email you send to a professor is a large determinant of whether you get to work with them or not, so it's very important.
Emails you send to professors are similar between undergraduate and graduate students; the difference is that you have to be a lot more specific about what you know, what you've done, and what you want in a graduate student email compared to an undergraduate student email. I'll include a graduate student email at the end so that you can see how this process of email-writing develops after you've accumulated some experience. But let's start with the slimmed-down version: a template for an undergraduate email.
Inbox Title: Undergraduate interested in your lab
Dear Prof. ,
*use Dear, not Hi or Hello. Make sure you say Professor / Dr. and not Mr. / Mrs.; these people have PhDs and faculty positions, both of which are hard to acquire and worth acknowledging.
I am an undergraduate student in [major] (*don't cite your minor; if it's not in science/math it's not relevant). I am very interested in your work, specifically [one sentence, e.g. how children learn language based on listening to audio streams. Base this off of what you've read on their website. Your project will almost always be disjoint from whatever you say here; the point is just to show that you went to the effort to look up what they do]. I have previously worked in Prof. [so-and-so's] lab on a project investigating [e.g. how auditory perception works in birds (showing how you're qualified). If you haven't worked in anyone's lab before, say: I have become interested in your work because of my coursework in x (showing why you're interested)]. I would enjoy the opportunity to work on [x, if you can suggest a project topic] in your lab as a [volunteer / for course credit since I saw you were advertising on your website / showing your level of time commitment / (omit this if you're not sure)] during the [time period, e.g. spring semester.]
If this would be of interest to you, I am happy to meet whenever you're available and forward any materials. [If you have a CV with research experience, you'll probably have described that research experience above and attached a more detailed CV anyway. But I don't think it hurts to offer; maybe they want to see a transcript or something.] Thank you for your time.
[Your name—I sign with my first if I've mentioned my full name earlier, but otherwise use my full name.]
There are several points here. The most important are that this email is short, professional, and shows interest. I'm not going to reference the above template, but just write a quick email from scratch; you can see how brief it is given that hypothetical me doesn't have any qualifications yet.
Inbox Title: Undergraduate interested in your lab
Dear Prof. McCartney,
I'm an undergraduate student in the Neuroscience major here. I was reading about your work on color perception on your website and am very interested in how babies learn to see color. I have taken Neuroscience 100 and enjoyed reading about visual perception; I hope to become involved in research to understand more. I would love to work in your lab if that would be of interest to you. I am happy to come by during your office hours if you were taking students at the moment.
Thank you for your time regardless,
Luckily, as an undergrad professors don't expect that much of you; they're just pleased if you show interest. But if you were to put together an email along these lines- ignore the specific phrasing, which I think is a bit clunky- that would increase your chances of getting into a popular lab. The goal is that you 1) show you've looked the lab up, 2) show your interest, 3) show your qualifications / why you're interested, 4) show your availability and willingness to meet, 5) be brief, and 6) be deferential. Professors usually want undergrads: it looks good on their CVs and grant applications, and they want people who have gone to all of the work to be interested and written a nice email. With luck, the professor will foist you off on a senior student or graduate student who is interested in mentoring you, and it'll all go smoothly from there.
Keep in mind that this is all you need. When I was learning to write these I struggled most with what I still find is a weird convention: you just don't express that much emotion in these types of emails. Using the word "love" is highly questionable. As someone who frequently uses emoticons and enthusiastic adjectives for emphasis, I was constantly told to tone it down; the most enthusiastic you can get is "I'm very interested". So don't use extravagant language and KEEP IT BRIEF (professors skim emails): straightforward and to the point and you'll be golden.
Just for comparison, here's one of my (slightly edited) emails that I wrote in applying for graduate school. There is a huge difference between the expectations for undergraduates versus graduates, which you will easily breach once you've gained all of the requisite research experience. I still have language problems in this email, and I think it's too long. However, this type of thing did get me into graduate school so there are good points in it.
Dear Prof. [x],
My name is [x] and I am a recent neuroscience graduate from [institution] College. I am planning to apply to [institution]’s Neuroscience program this fall, and am very interested in your work. I wanted to ask if you were taking graduate students in the fall of 2016?
As an undergraduate I worked for three years in Prof. [my PI] lab at [institution], which allowed me the opportunity to hear your talk during the [x] undergraduate program this summer. I enjoyed your discussion of the brain’s representation of animacy and real-world object size at that time, and recently I have been enjoying reading your more recent papers on the brain’s representations of objects and what features are governing the organization of those representations. My interests are in understanding the computational and neural bases of human perception and learning, and I would love to use various analysis methods with fMRI, combined with behavioral studies, to investigate high-level visual representations in your lab, if that were of interest to you and I were accepted into [institution]’s graduate program.
In Prof. [my PI]’s lab I had the opportunity to process fMRI data from subjects using FreeSurfer, and I have created anatomical and functional ROI labels in anatomical and diffusion-tensor-imaging space. Though I have never performed MVPA or representational analyses, I designed a mock proposal using MVPA in Prof. [x]’s “[class name]” as a student at [institution], and I am familiar with the computational concepts from taking “[class name]” at [institution]. My most longstanding project in Prof. [my PI]'s lab was analyzing electrophysiology data in Matlab, and I replicated part of two computational color papers in Matlab as part of an independent study with Prof. [y] ([institution] Computer Science Department) my senior year. As part of my senior thesis, I also created a small PsychToolbox perceptual experiment for human subjects. I have classroom knowledge of Java and some experience with Python.
This year I am pursuing a one-year, research-only Masters in Psychology at the [institution], working with Dr. [new PI]. Dr. [new PI] investigates the learning strategies that humans use to automatically extract structure from visual stimuli, and how the brain’s representations change as a consequence of this learning. She uses behavioral studies, fMRI, and computational modeling in her work, and I hope to gain experience in using these techniques to investigate visual perception and cognition in her lab.
I would love to work with you on extracting the higher-order features that govern how we perceive and represent visual stimuli if that would be of interest to you. I have attached a CV and would be happy to provide any other information, and thank you very much for your time.
(And here's a post from a science professor who details what she looks for in a graduate letter step-by-step!)