Let $S$ be a smooth, projective surface over $\mathbb{C}$ and let $\xi$ be a $0$-dimensional subscheme. I look at the sheaf $\underline{Ext}^2(O\_\xi,O\_S)$. Is it true that, if $\xi$ is curvilinear, then $\underline{Ext}^2(O\_\xi,O\_S)=O\_\xi$? What happens instead if $\xi$ is not curvilinear?



Curvilinear subschemes and Ext functors.
Yes, it is true. Indeed, if $\xi$ is curvilinear then it is lci, so locally there is a resolution
$$
0 \to O\_S \xrightarrow{ (g,-f) } O\_S \oplus O\_S \xrightarrow{ (f,g) } O\_S \to O\_\xi \to 0.
$$
Applying local $Hom$ to $O\_S$ one obtains an exact sequence
$$
0 \to O\_S \xrightarrow{ (f,g) } O\_S \oplus O\_S \xrightarrow{ (g,-f) } O\_S \to \underline{Ext}^2(O\_\xi,O\_S) \to 0.
$$
It is clear that the second complex is isomorphic to the first, so $\underline{Ext}^2(O\_\xi,O\_S) \cong O\_\xi$.


On the other hand, the simplest example of a subscheme which is not curvilinear is $\xi = Spec\ k[x,y]/(x^2,xy,y^2) \subset Spec\ k[x,y]$. There is a resolution
$$
0 \to O\_S^2 \xrightarrow{ \left(\begin{smallmatrix} y & 0 \cr -x & y \cr 0 & -x \end{smallmatrix}\right) } O\_S^3 \xrightarrow{ (x^2,xy,y^2) } O\_S \to O\_\xi \to 0.
$$
Applying local $Hom$ to $O\_S$ one deduces that
$$
\underline{Ext}^2(O\_\xi,O\_S) = Coker(O\_S^3 \xrightarrow{ \left(\begin{smallmatrix} y & -x & 0 \cr 0 & y & -x \end{smallmatrix}\right) } O\_S^2).
$$
It follows that as a $k[x,y]$-module it is a vector space of dimension 3 with the action of $x$ and $y$ given by 
$$
x= \left(\begin{smallmatrix} 0 & 0 & 0 \cr 0 & 0 & 0 \cr 1 & 0 & 0 \end{smallmatrix}\right),
\qquad
y= \left(\begin{smallmatrix} 0 & 0 & 0 \cr 0 & 0 & 0 \cr 0 & 1 & 0 \end{smallmatrix}\right).
$$
In particular, it is not generated by 1 vector (as a $k[x,y]$-module), so it is not isomorphic to $O\_\xi$.


