TITLE: In category theory: What is a fibration and why should I care about them?
QUESTION [21 upvotes]: I stumbled upon the "fibration of points" in the definition of a protomodular category and apparently this is indeed an instance of a fibration. 
What are fibrations intuition-wise and how are they important? 
I would like to have an answer that can be comprehended by an undergraduate, who knows a bit of category theory (but almost no higher category theory or topology), if that is at all possible.

REPLY [7 votes]: A classical example of a fibration is the codomain fibration on a finitely complete category $\mathcal{C}$-- that is, the functor from the arrow category $cod:\mathcal{C}^\to \to \mathcal{C}$ with action on objects $(f:c\to d)\mapsto d$ and action on morphisms taking $\langle g_0:c\to c',g_1:d\to d'\rangle:(f:c\to d)\to(f':c'\to d')$ to $g_1$. Note that for any $c\in\mathcal{C}$, the collection of objects $f\in\mathcal{C}^\to$ with $cod(f)=c$ and morphisms  with $cod(\langle g_0,g_1\rangle)=id_c$ forms a category (called the fibre over $c$); in fact, the category $(\mathcal{C}\downarrow c)$. Moreover, pullback along a morphism $h:d\to c$ in $\mathcal{C}$ allows you to take an object of $(\mathcal{C}\downarrow c)$ to one in $(\mathcal{C}\downarrow d)$, and similarly for morphisms.
Here one would like to say that $cod$ is actually encoding a functor $(\mathcal{C}\downarrow-):\mathcal{C}^{op}\to\mathbf{Cat}$; morally, this is what's going on, but there are two problems that prevent me from dropping the qualifier "morally". First, a composition and pullback don't strictly commute: $f^*g^*(x)$ is not generally identical to $(gf)^*(x)$ (though they're isomorphic), so the proposed functor to $\mathbf{Cat}$ isn't strictly functorial. Second, a morphism $f$ may have many pullbacks along a given morphism $h$. So the "pullback along $h^*$" operation that we want to think of as a functor (a morphism in $\mathbf{Cat}$) isn't actually even functorial unless we're able to choose a particular pullback for every pullback diagram.
Nevertheless, we can say intelligible things about codomain fibrations, even talk about "right adjoints" to pullback, as in the case of locally Cartesian closed categories, when what we have a right adjoint to isn't strictly even a functor.
Why have I talked so much about the codomain fibration? You have probably been exposed to the notion that you can think of a morphism $d\to c$ as an abstract family indexed by by $c$, and pullback is a reindexing operation (like the operation where, given a family of sets $\{A_i\}_{i\in I}$ and a function $f:J\to I$, you can make a new family $\{A_{f(j)}\}_{j\in J}$). The codomain fibration is a nice example of a situation where it's easy to use the metaphor of indexed families and reindexing, while finding easy examples of where the reindexing operation isn't quite as nice as the case of set-indexed families. This is what fibrations are meant to model in their full generality-- given a fibration $p:\mathcal{E}\to\mathcal{C}$, we think of the fibre over an object of $\mathcal{C}$ as a category structures indexed by that object, and we are given a contravariant "reindexing" operation which is well behaved enough to work with, but general enough that we're not tossing out perfectly good examples like codomain fibrations. They also give you a venue to think about things like $\mathcal{E}$-valued functors on categories internal to $\mathcal{C}$, when this might otherwise be hard to even phrase.
I haven't gone into the details of exactly what makes a fibration because the definition is perfectly available, but references like Borceux's Handbook of Categorical Algebra, vol 2, or Jacobs are good places to learn more.