The Supernatural PTB have admitted they goofed in writing Sam's absence as only two years. Most of the fanfics I've read have extended the time to four years. Based on my knowledge of and experience with the law school admissions process, I'd say the most probable answer is three years.
The American undergraduate system typically requires four years to complete. Unlike other countries (such as the UK), students must complete an undergraduate degree before they are permitted to study for an entry level law degree.* Those undergraduates who want to go on to become lawyers may study any subject(s) they wish as an undergraduate, though history, economics, and politics (among other social sciences) are particular favorites of future lawyers. Some undergraduate schools have a pre-law course of study (Standford doesn't), however, most law schools don't favor or encourage a pre-law major because they believe that effective instruction in law is not possible outside of a law school setting (there's got to be some reason you're paying
John Houseman $20,000/year to repeatedly humiliate you, right?).
All ABA-approved** law schools (including Stanford Law) require applicants to take the Law School Admissions Test (LSAT). The LSAT is a national exam administered four times a year: February, June, October and December. Aspiring lawyers (and former wannabe doctors who found they couldn't muster a passing grade in calculus) generally begin considering the law school applications process during their third year or summer prior to fourth year. Many applicants will take the exam in June of third year because it gives them the summer to consider their options before the applications cycle begins in September of fourth year. October of fourth year is generally the latest applicants will take the exam (though December and February are technically possible). Law schools generally begin accepting applications in September for admission to next September's class, and earlier applications (with an LSAT attached) are usually better (because they indicate that you have a high degree of interest in that particular school). Though schools won't notify most applicants of their acceptance/rejection until at least January/February of their fourth year, most schools admit on a rolling basis, thus an applicant may know that they have been accepted as early as late November/early December of their fourth year. The higher your combined LSAT/undergraduate grades are above the average for those admitted to that school, the earlier you will receive notification of admission.
In the pilot episode, we see Sam at a Halloween party, at which he and his friends are celebrating Sam's "awesome LSAT score" of 174. From the conversation, it sounds as though Sam just received news of his score, which indicates that he took the exam in October, implying that Sam only a couple of months into his fourth year at Stanford. Sam also talks about an upcoming 'interview' with Stanford Law, which may result in a scholarship for Sam. This seems somewhat unlikely, but possible, if Sam sent an application to Stanford with indication that he would take or had just taken the October LSAT. In either case, the admissions officer would have to be acting pretty quickly to decide that they wanted to invite Sam for a scholarship interview within days of his receiving his score. Alternately, Sam may have taken the exam in June and only recently told Jess about the score (which would make the interview timeline more likely). Either way, it's pretty certain that Sam is just starting his fourth year, which would make his time apart from his family roughly 3 to 3.25 years.
Sam could have been a full four years away from his family if he was a 'fifth year senior' (someone who is on a five-year track to graduation rather than four-year track). This generally happens when an undergraduate changes his major course of study in a significant way, necessitating a lot of extra courses that can't be completed in the remainder of his four years, or if the student had a lot of trouble and needed to take courses over, or dropped out for a semester or two. Given Sam's intelligence, this scenario seems unlikely to me.
If you feel the need to comply with canon, Sam could have been away from his family for only two years, provided he was on track to complete his undergraduate degree in three rather than four years. This accomplishment is unusual, but some people do manage it through a combination of summer course work, extra courses during the year (taking credit hours over the required amount to maintain full time student status), and
advance placement tests completed in high school. Sam is certainly smart enough to have done it.
How smart is Sam? LSAT scores range from 120-180. The average score is a 150. The distribution of LSAT scores resembles a onion, with a very high percentage of scores in the middle, and fewer scores at the extremes than found on a bell curve. The majority of scores are within five points of 150, and scores above 160 are quite unusual. A score of 163 or higher qualifies for
automatic admission to MENSA.
Even more than your law school grades, what school you attend determines your legal career. The most selective legal employers (big name firms, appellate and Supreme Court justices, the Department of Justice) won't even interview you if you weren't admitted to a school in the top tier (#1-#25) of the
US News and World Reports rankings system. Thus, American law school admissions are extremely competitive and entirely impersonal. Admissions are generally determined on a grid of applicant grade point averages (GPAs, the average of the applicants grades throughout their undergraduate study) and LSAT scores, with more weight given to LSAT score than GPA. Those who have a weighted average above the cut-off get in, those with a weighted average below the cut-off are rejected. Your place on this grid might be slightly tweaked by the caliber of your undergraduate institution (attending an Ivy League school notching your placement up, No-Name University notching it down a bit), but for vast majority of applicants the numbers alone are life and death.
Though most schools (including Stanford) require at least two letters of recommendation (from undergraduate faculty) and a personal essay statement, these measures only come into play if you are on the borderline between admission and denial. Unlike undergraduate admissions, interviews are uncommon and generally irrelevant (you may request one, and the school's admission office will likely grant it, but unless you've got mind-control powers, it will have no effect on your application). There is also some room in the marginal cases for for 'diversity' applicants (generally racial and ethnic balancing, with some effort of balance the class by age, geography, and socioeconomic status).
Stanford Law was ranked #2 for 2007, making it most competitive of the lot. Like most law schools in the top tier, it has no reason to offer an academic scholarship -- the best applicants will apply and attend regardless. Loans to attend law school (government and private) are plentiful and offered at a low interest rate because of the high probability that those who complete a degree will find lucrative employment. Stanford does offer some need-based scholarships, which is almost certainly what Sam's interview was about.
For 2007, the averages LSAT score of the bulk of admitted students (students in the 25% to 75% percentile of admitted students) ranged from 167-72. Provided Sam had excellent undergraduate grades (3.5 to 4.0 GPA), he was a shoo-in for admittance and might well have received early notification of admission. Sam could have gone to any law school in the country, and chances are his IQ is genius level. Sam is not just smart; Sam is scary smart, which explains why he could have gained admission to an Ivy League school despite a nomadic childhood and a parent who was not exactly a dedicated member of the PTA.
------------------------------------------
* The entry level law degree is a juris doctor or J.D. For the vast majority of American lawyers, this is the only law degree they will ever need or complete. It typically requires three years to complete. With a J.D. and a successful score on any state's bar exam, one may practice any type of law except patent law (which has a separate bar exam).
** All state bars require applicants who want to be permitted to take the state's bar exam on the basis of the completion of a J.D. to have attended a law school approved by the American Bar Association (ABA). The ABA is the voluntary, non-governmental but quasi-official organization which governs the study of law in the US. Most legal employers also require an ABA-approved J.D. Theoretically, ABA approval ensures that everyone who graduates from an American law school is prepared to take a bar exam and qualified to practice law. As a 'happy coincidence', it also limits the number of law schools, and thus the number of lawyers in the US.