Random effects and fixed effects are terms used in statistical modeling. The contrast between them causes a lot of confusion. Random and fixed effects originate in the data sampling plan and analysis plan and must be dealt with differently in statistical analysis. Sometimes, a statistical model includes both random and fixed effects; this requires a type of model that has many names, including mixed model and hierarchical model.
Distinguishing Between Random and Fixed Effects

Perhaps the simplest way to distinguish between random and fixed effects is to imagine doing the same study again. Would you have the same levels on the variable in question? If so, it is a fixed effect. If not, it is a random effect. Another way of distinguishing fixed vs. random is to ask if these levels can be thought of as a random sample from a larger population. If so, it is a random effect; if not, it is a fixed effect. Yet another way is to ask if you are interested in these particular levels or if these are just the levels you happened to get in this study.
Example of Distinguishing Random and Fixed Effects

For example, if you were studying whether male or female professors gave higher grades, then sex would be a fixed effect (because you would always survey men and women); but, professor would be a random effect, because if you did the study again, you would survey different professors. These professors are a random sample of all professors, and you are not interested in these particular professors. On the other hand, if you were studying which professors in your department at your school were the clearest lecturers, then professor would be a fixed effect, because if you did the study again, you would survey the same professors. These professors are not a random sample, and you are interested in these particular professors.
Implications for Analysis: Random vs. Fixed Effects

If professor is a random effect, then we think of each professor as having a particular intercept, and the variation about that intercept becomes part of the error term. We are not interested in whether Prof. Bob Smith gives better grades than Prof. Mary Jones, we are interested in whether men give better grades than women. However, when professor is a fixed effect, then we estimate a regression parameter for each professor, because we are interested in which professors in our department are better or worse. In brief, random effects become part of the intercept, and fixed effects get parameters.
Analysis for Random and Fixed Effects

When you have both random and fixed effects on the same variable, things get more complex. One example of this is repeated measures over time. For example, if you measured each professors' grades multiple times, but were interested in comparing men to women, then the professor would be both fixed (because you look at each professor more than once) and random (because you are not interested in these particular professors). In this case, the best approach is a mixed model (also known as hierarchical models and multilevel models), which combine random and fixed effects.