It turns out that tying a tie is equivalent to a so-called persistent random walk on a triangular lattice. Using this model, the number of all possible knots is calculated. The optimal knot is determined by the aesthetic conditions of symmetry and balance. Of the 85 tie knots found, our model duly predicts the four knots in widespread use and further introduces nine new aesthetic ones.