\begin{tikzpicture}[ultra thick, spy using outlines={circle,lens={scale=3}, size=2cm, connect spies} ]
  \begin{scope}
    \clip (-.5, -.5) rectangle (2.5, 3.5);
    \draw[-latex] (-.5, 0) -- (2.5, 0);
    \draw[-latex] (0, -1) -- (0, 3);
    \draw[color=gray, dotted, step=.5](-.5, -1) grid (2.5, 3);
    \draw (0, 0) node[below left]{$\mathcal{O}$};
    \draw[smooth,domain=-0.5:2.5] plot(\x,{\x*(\x-1)*(\x-2)+1});
    \draw[blue,smooth,domain=1.6:2.5] plot(\x, {2*\x-3});
    \draw[dashed] (2, 0) node[below]{$a$} -- (2, 1);
  \end{scope}
  \spy[red] on (2, 1) in node [fill=white] at (1.2, 2.7);
\end{tikzpicture}
