Let $\cal A$ be a deterministic finite automaton that accepts the language $L = \{a^n b^n : n \geq 0\}$. Denote by $q_n$ the state that $\cal A$ arrives at after reading the word $a^n$. Since $\cal A$ has only finitely many states, by the pigeonhole principle we must have $q_n = q_m$ for some $n \neq m$.
What happens when $\cal A$ reads $b^n$, starting at $q_n$? On the one hand, since $a^n b^n \in L$, $\cal A$ must arrive at an accepting state. On the other hand, since $a^m b^n \notin L$ and $q_m = q_n$, $\cal A$ must arrive at a rejecting state. This contradiction shows that $\cal A$ cannot exist.
This argument can be generalized to give a neat algebraic characterization of the regular languages, known as Myhill–Nerode theory. Given a language $L$, say that two words $x,y$ are equivalent if for all words $z$, either $xz,yz \in L$ or $xz,yz \notin L$. If $x,y$ are not equivalent that any automaton accepting $L$ must reach different states after reading $x$ and $y$. Hence if there are infinitely many pairwise inequivalent words, $L$ is not regular. The Myhill–Nerode theorem states that the converse also holds: if any collection of pairwise inequivalent words is finite, then $L$ is regular.
Normally this is stated in terms of equivalence classes: $L$ is regular if and only if the Myhill–Nerode relation (the equivalence relation defined in the preceding paragraph) has finitely many equivalence classes. Moreover, if $L$ is regular and the Myhill–Nerode relation has $n$ equivalence classes, then every DFA accepting $L$ must have at least $n$ states, and there is a unique DFA with exactly $n$ states, known as the minimal DFA.