Summarize:

Before jumping in and asking him out, make sure you know that he would be open to some kind of relationship. There are a few different variables to watch for, some of which you can pick up while in class or talking around campus. Check his relationship status. If your professor is single, then you should feel comfortable at least trying. If he is married, you may still be able to get a physical relationship out of it, but it will probably be very secretive. Of course, you have to decide if that kind of person is someone you want to be involved with. Learn his preferred gender. College campuses are among the most welcoming environments for a variety of gender preferences. You don't want to embarrass yourself by asking out your professor only to discover he prefers a gender other than yours, so look for clues to who he likes. This covers both you and your professor. Either of you could get in trouble for acting on an attraction, especially if the feeling is not mutual. If your professor does not respond to your pursuit, drop it. It's definitely not worth getting in trouble with the university for harassing him. Most schools have policies against professors dating students, and they are strictest when it comes to students they are actually teaching. To avoid unnecessary headaches for both of you, don't act on your feelings until the semester is over. Your best bet is really to wait until you have graduated. That gets rid of any chance you will ever have a class together in the future. Even if your relationship is over by that point, a bad ending can have lasting repercussions on your grade or classroom demeanor. It will also be much easier for your professor to see you as mature if you are not still in school. Remember that when you are in the class, your relationship is definitely unequal. Your professor holds a significant amount of power as the person who teaches and grades the class. It is never good to be intimate with someone who has that kind of influence over your future. If your professor is younger and untenured, a relationship with a student is a good way for him to lose his job. Understandably, he will be unlikely to take a risk like that. Even tenured professors can lose their job over dating students. If you want a relationship with your professor, you will probably need to be direct about it. Given the potential complications, as well as the concern over sexual harassment complaints, he will probably be very hesitant to ask you himself. Being direct also means both of you know what is happening. This is not the time for grey areas. If you are both clear about your romantic intentions, he will be more likely to reciprocate appropriately. Be warned that some professors will encourage relationships with their students (especially male professors and females students) to bolster their own egos. If you think your professor is using you in this manner, get out before anything happens. Be aware of how he acts around you. If he is willing to initiate flirting quickly or suggests things that past students have done, and otherwise blatantly ignoring school rules, he is probably signaling that you are not the first, and probably won't be the last. There can be other signs in the classroom. Watch to see if your professor flirts regularly with other students along with you, brags about his attractiveness, or seems to be hung up on how the students see him. These can all be signs he sees relationships with students as a way to boost his own ego. Professors who date their students will quickly develop a reputation in their department, even if the department doesn't do anything about it. If you have a concern, older students and TAs will probably have more information.
Know your professor's status. Know your university's rules for sexual harassment. Wait until the semester is over. Ask directly for a date. Don't get played.