The crucial idea of a limit is that it describes the behaviour of a function near a point, not at the point itself. The value of \(f(a)\), or whether it even exists, is irrelevant to the value of the limit.
Consider the function \(f(x) = \dfrac{x^2-1}{x-1}\). At \(x=1\), the function is undefined. However, for any \(x \neq 1\), we can simplify:$$ f(x) = \dfrac{(x-1)(x+1)}{x-1} = x+1. $$The graph of \(f(x)\) is the line \(y=x+1\) with a "hole" at \(x=1\). As \(x\) gets very close to 1 from either side, the value of \(f(x)\) gets very close to 2. Therefore, \(\displaystyle\lim_{x \to 1} f(x) = 2\), even though \(f(1)\) is not defined.