Why do we study prime ideals?
There is a strong conceptual reason to study the prime ideals of a ring: in algebraic geometry, we can study / think about a ring $R$ using an associated geometric object called $\mathrm{Spec}(R)$, the points of which are precisely the prime ideals of $R$. This idea is one of the many Grothendieck introduced, ushering in "modern" algebraic geometry.
(on the left: the frontispiece of Reid's Undergraduate Commutative Algebra)
(on the right: Mumford's famous sketch of $\mathrm{Spec}(\mathbb{Z}[x])$; note that $\mathbb{Z}[x]$ is not Dedekind.)
However, I don't have enough time at the moment to give a detailed explanation of the above; I'm sure someone else will be able to. But just to offer a perhaps more mundane answer: there are many properties $\mathsf{X}$ that an arbitrary commutative ring might have that are local, in the sense that $$R\text{ has property }\mathsf{X}\iff R_P\text{ has property }\mathsf{X}\text{ for all prime ideals }P\subset R,$$ where $R_P$ is the localization of the ring $R$ at the prime ideal $P$. The same is true for arbitrary modules over arbitrary commutative rings; that is, if $M$ is a module over $R$, then there are many module properties $\mathsf{Y}$ for which $$M\text{ has property }\mathsf{Y}\iff M_P\text{ has property }\mathsf{Y}\text{ for all prime ideals }P\subset R.$$
One of Qiaochu Yuan's blogposts addresses exactly this question.
The central fact is more or less obvious (that the prime ideals are exactly the kernels of homomorphisms of $R$ into domains) but it does a great job of explaining why that is useful and natural to study.
An answer from algebraic geometry is that the set of prime ideals of a ring satisfy the axioms for a closed set in a topology. My personal elaboration on this answer is the following.
To interpret a ring $R$ "geometrically" is to interpret the ring $R$ as a ring of "functions" on a "space" $X$ such that the collections of points of $X$ on which "functions" of $R$ "vanish" form interesting "geometric" objects that we thinkof as living in the "space" $X$.
Making this precise amounts to the following:
- The ring $R$ consists of functions on $X$ means that there are (surjective) evaluation maps $R\to R_x$ notated as $f\mapsto f(x)$, where $R_x$ is the set of values that the elements of $R$ can take when evaluated at the point $x\in X$. Note that for the sake of generality, we may have different sets of values possible at different points.
- We say that A function $f\in R$ vanishes at the point $x\in X$ if its value $f(x)$ at that point is the same as the value $0(x)$ of the zero element of $R$ function (this is the same as requiring that vanishing is a point-wise condition, and that $0$ vanishes everywhere).
- Further, we wish vanishing to satisfy nice properties: if a function $f$ vanishes at $x$, so does any multiple $f\cdot g$ of it, and two functions $f$ and $g$ have the same value at $x$ if their difference vanishes at $x$.
These three basic properties ensure that the evaluation maps $f\mapsto f(x)$ give each $R_x$ the structure of a quotient ring, and hence each evaluation map corresponds to an ideal of $R$. I like to call this ideal $\ker x$ because I like to think of the points on the space as the evaluation maps. Clearly, from the point of view of the ring $R$, points with the same kernels are indistinguishable, so we can in fact identify the "space" $X$ on which the ring $R$ is a ring of "functions" as simply a collection of ideals of $R$, which we designate as special point ideals.
What is interesting is that now vanishing can be easily interpreted as follows: $f$ vanishes at $x$ if and only if $f\in\ker x$ if and only if $\left<f\right>\subset\ker x$. Pushing this further, a collection of functions vanishes at a point $x$ if and only if $I=\left<f_i\right>\subset\ker x$, so a "geometric object" defined as where a collection of functions vanishes consists of the point ideals of $R$ contained in an ideal: geometric objects are specified by ideals of $R$!
Now, the geometric objects behave nicely: arbitrary intersections of geometric objects are geometric objects. Unfortunately, they are not nice enough without an extra assumption: if we want the union of two geometric objects (as collections of point ideals) to be a geometric object, then it is in fact necessary that every point ideal be prime. Once this assumption is made, we can talk about finite unions of geometric objects and arbitrary intersections of them, which allows us to talk about the geometric objects "locally": by investigating small manageable pieces of them, which we would then patch back together.
My answer cannot - and doesn't want - to keep pace with the other learned answers already given, but I'd like to make the point, that prime ideals are dual to ultrafilters, and that the ultrafilters of Boolean algebras (= Boolean rings) correspond to complete theories, which makes them interesting in their own right.
How this could make them interesting in the case of general algebras/rings: I have no idea.