What does it take to get a job at a top 50 math program in the U.S.? I'm a senior undergrad right at a small liberal arts college right now who is applying to math PhD programs in the U.S. I would like to eventually become a professor at a relatively good university that has a good environment for doing mathematics. But I'm concerned that since the schools I'm applying to are not at the very top, I am basically preventing myself from having that opportunity. For example, some professors at my college suggested that I apply to Univ. of Oregon and Univ. of Georgia, because they have strong faculty in algebra. But I looked at where past doctorate recipients from Oregon went, and they usually end up in small colleges that are pretty unknown. That is making me hesitant about applying to Oregon. 
I consider myself a strong student (and so do my letter writers, and I guess that's what really matters) but I have poor math GRE scores that my professors think will severely limit my chances of getting into a program at the top 40 schools (e.g. they said I had a shot at, say, Univ. of Washington, UCLA, Chicago, and Michigan, before I got my GRE scores). 
Some of my professors don't think the prestige of the grad school matters that much (i.e. as long as I write an interesting thesis and make my results known, I should be fine). But I have a feeling that my professors may be a bit out of touch, since I go to a liberal arts college, not a research university. And when I look at where past PhD students from good programs (e.g. in the Group I list in the AMS rankings but not top thirty) go to, I get a bit concerned. Maybe I should take a year off and try again next year. I was wondering if anyone had any advice.
 A: Well, for one, you can try to retake the GRE as that could change your dynamic quite a bit. 
As for people going to "mid-level" PhD programs, in my field you do continually get a small number of people managing to go from such programs to embark on successful research careers. They almost always are from departments where my field is especially strong.. I don't actually remember ever seeing a person with a PhD in my field in a mid-level department where my field is so-so who was able to become a professor at say a top 50 place, but I imagine it has happened.
What you might want to do, once you are done with the application process and have gotten all your acceptances is try to find out what happened to recent graduates in your proposed field at the places you got into. Some departments are pretty forthcoming about this information. Then you can ask yourself if going there is a risk you are willing to take. How willing are you to end out a teaching place, or in industry? Of course it may be impossible to know that early, but I think it's ultimately a personal decision that you have to make.
Incidentally, when it comes to people with PhDs from places that are well below average reputationwise, I have seen a number of job applications from them, and they virtually always are nowhere near the type that end out as research mathematicians. I do try to keep an open mind when looking at their files, but still that's what I see. So if you're set on being a research mathematician maybe going to such places would not be such a good idea.
A: I can add anecdotal evidence for my former program, which wasn't math proper but attracted a fair number of math undergrads, if not people with Ph.D.s in physics prior to even entering this particular Ph.D. program. 80% of the faculty were Ph.D. In math or OR or stats. The program and the school's math department were highly ranked. A poor GRE would have been a killer. The GRE served as a first selection barrier: if you had less than x%, your application wasn't even looked at (I slipped in at precisely x, incidentally). Next mattered the names of your letter writers (and so implicitly their schools) - the content of letters is pretty much irrelevant as everyone is praised as oh-so-brilliant anyway. When it came to job market for graduates, we hardly looked at people from schools less than, say, rank 10. These experiences were not for the math department, as said; but I very much assume it was similar there.
If feasible, I warmly recommend to wait a year and take the GRE several times, as needed (I took it twice). 
A: You've gotten a lot of very relevant advice and suggestions up above.  Taking everything together, there's one other extremely important factor in getting a tenure track job at a good math department: luck.  You need a lot of it.  
Mathematics is a beautiful subject and worth studying.   And it's not my intention to discourage you.  But if you want to pursue a career in mathematics, keep an open mind about what you are willing to do, because you won't get a tenure track job in mathematics unless you are not only talented but also lucky.
A: I am a (tenured, associate) professor at UGA, which is a top 50 math department but is not part of the AMS Group I list.  I got my PhD at Harvard, which is consistently ranked as one of the top three programs in the US (along with Princeton and Berkeley, with places like Chicago, MIT and Stanford close behind). 
At every math department I have ever seen it is quite true that, on average, if you succeed in landing a tenure track academic job at all, it will be in a department which is at least a level below the program where you trained as a graduate student.  Looking at the numbers involved explains why this has to be the case: a decent-sized department may grant 10 PhDs each year and hire tenure track faculty once every two or three years.  So everyone can expect to hire a candidate of much higher quality than the average PhD they produce.  (I should add that the candidate's "quality" depends on many things other than where they themselves got their PhD.  A Harvard PhD does not guarantee a tenure track job at a top 50 department: the percentage of Harvard PhDs who get such jobs is probably around 50%, maybe a little lower.)  
Many -- probably half or more -- of the graduates of the PhD program at UGA are interested in primarily teaching positions in regional colleges and universities.  But a non-negligible percentage go on to strong research careers.  For instance, there is
James Haglund, a 1993 PhD, now a tenured associate professor at UPenn,
Kevin James, a 1997 PhD, now a tenured associate professor at Clemson,
Ernie Croot, a 2000 PhD, now a tenured associate professor at Georgia Tech,
Gerard Awanou, a 2003 PhD, now a tenured associate professor at Northern Illinois,
Valerie Hower, a 2007 PhD, now a tenure track assistant professor at U. of Miami,
and this is not an exhaustive list.  So getting a PhD at a place like UGA certainly keeps alive the dream of a career in mathematical research.
Also, I don't want to sound discouraging, but based on what little information you've provided it's not clear that you're a shoo-in for admission at a department like UGA.  A lot of it depends whether your "small liberal arts college" is a place like Amherst or Colby or Smith -- i.e., a place where we will probably know your letter writers, at least by reputation -- or a small liberal arts college that we've never heard of.  Excellent grades at a place we've never heard of and excellent recommendations from people we've never heard of combined with poor GRE scores has not in the past been a formula for success at UGA.  
I do think that trying to get a PhD at a department significantly worse than UGA -- say, not in the top 100 programs -- is not laying much groundwork for a future academic research career.  If you don't get into a top 100 program this year, then spending a year improving your application and, especially, your GRE scores, is a better strategy than enrolling in a program none of whose graduates go on to research careers.
A: I think your professors are sadly misinformed.  It's hard to get a job at a top department (which for this answer I'll take to mean an AMS group I department; see http://www.ams.org/profession/data/annual-survey/group_i), no matter where you went to graduate school.  
Perhaps some anecdotes will be helpful.  I want to preserve my anonymity, so I can't get too specific, but here goes.  I got my PhD about 15 years ago from a department that essentially everyone would rank as a "top 5 department".  Looking at my classmates, about 20% are tenure stream faculty at AMS group I departments, 20% are tenure stream faculty at research universities that are lower ranked, 25% are tenure steam faculty at teaching institutions, and the remainder have dropped off the face of the earth (probably they went and got jobs in industry).
I am currently at an AMS group I university, but not a top 10 department or anything.  Since I arrived, we've hired a number of other people in pure mathematics, and I don't think we've interviewed anyone who didn't have a PhD from a top 10 department.
Of course, nothing is impossible, and it is easy to point to people who got their degrees from non-top departments who ended up doing great.  But these are exceptional people.  Most people end up getting jobs at lower-tier places than the places they get their degrees.
By the way, I do agree that both UGA and Oregon have exceptional algebra groups.  However, your assessment that few of their graduates go on to jobs at research universities is correct.
A: Complementing points made in other answers, and Akhil M's question/comment: it's not only the prestige of the highest-ranked grad programs, but the arguable fact that one is exposed to "better" mathematics there. E.g., the chances that one is guided to an "interesting thesis" are probably higher at higher-ranked schools. This presumes that one pays some attention to the advice one is given by the presumably-first-rate faculty there, and assimilates presumably-first-rate attitudes and viewpoints about methodology, goals, and taste. I think ideally grad school changes a person to be a better mathematician. It's not just dues-paying and hoop-jumping, while waiting to write up one's clever ideas. Certainly if one is not open to learning new things (except superficially), it can be degraded to that, but it oughtn't be.
(Edit: it is plausible that the internet allows access to previously inaccessible things, but the internet includes "everything", and, while judgemental in some senses, is not critical... Immediate personal contact with people may yet have some purpose...)
As Pete Clark and others did/would comment, it does appear to be the case that the ranks of grad school, postdoc, and tenured position are non-increasing, probably decreasing significantly. Not only is this statistically observable, but there are some not-crazy reasons for this dynamic. The most obvious is just the counting argument about how many PhD's are produced, versus hiring. That alone might swamp all other considerations.
About GRE subject test scores: by all means retake the thing if you had a disappointing number. Even though people realize that it's a fairly silly test, there seem to be enough talented students out there who can cope with this silly test so that it is feasible to use it as first-pass filter. 
The prestige of your letter writers is very important, and what they say is very important (despite the inflation).
The flip side of some of this is the self-referential nature of "the best mathematics/program": the best math is what is done at the best schools? :)
Similarly, do you want to have a successful research career in your own perception, or in someone else's? These are not reliably the same thing. One could argue that the strictures of "top-level research" are fairly tight... and this might not be exactly the mode of operation you want.
Finally, I think it depends greatly on one's personality as to whether the most challenging situation possible is best, or, rather, a more forgiving, indulgent situation. Mixed in with this is the clumsy or accidental stress created in many human interactions, and the statistically typical communication difficulties of people in mathematics. That is, depending on the person, and depending on the details, stress can be productive or destructive. Oddly, the GRE and such things are one sort of "stress test", although I am not confident that they measure very much about mathematics. Is it necessary to be "tough" to be a mathematician? No, certainly not, but it may have as corollary that one can cope with more circumstances than others...? While this surely is a general advantage, still, the details matter.
In summary, trying the GRE again is reasonable, and getting the best letters you can. Apply to a range of schools (even though it costs money: the investment is worth it). Grad schools really don't want to admit anyone they don't feel will succeed, and they're very practiced at gauging these things, so there's little risk that you'll accidentally find yourself out of your depth, even if you are not sure yourself at this moment what the depth is. That is, get your application looking the best you can manage, and let the grad programs appraise you.
A: This voice from an earlier geological era doesn’t have much experience that still is relevant, except for this one recommendation:
Don’t sell small-college teaching short. There are some that don’t overload you with teaching responsibilities, and also offer a research-friendly atmosphere. For instance, I started at Bowdoin before finishing my thesis, and I had plenty enough time there to finish it and do further research beyond the thesis. And I know from a recent visit there that this pleasant aspect of that school has not changed. There are a number of other liberal-arts colleges that any research mathematician can be happy to land at. Carleton and Amherst spring to mind immediately, and I’m sure that there at least several dozen more.
