In one variable, $x^q - x \equiv 0 $ for all $x \in \mathbb{F}_q$.
This function would not be constant over an algebraic extension $\mathbb{F}_{q^2}$, which can always be constructed
In 3 variables, $(x^q+y^q+z^q) - (x+y+z) \equiv 0 $ .
The notions of "algebraic surface" and "tangent vector" are shaky in finite characteristic. I guess you could formally write the partial derivatives:
$$ a \partial_x P + b \partial_y P + c \partial_z P = 0 $$
Still not sure what it "tangent to $S$" means in finite characteristic.
There may need to be some condition on $P,S$ even if the degrees are small.
In two variables, $S = \{ xy = 1: x,y \in \mathbb{F}_q\}$ and then $P(x,y) = x^k - y^{(q-1)-k}$ is identically zero. We can check:
$$ x^k - y^{(q-1)-k} = x^k - x^{k-(q-1)} = x^k - x^k = 0$$
for any $x \in \mathbb{F}_q$. The partial derivatives are $\partial_x P = k \,x^{k-1}$ and $\partial_yP = [(q-1)-k] \;y^{(q-2)-k}$ . That... disproves the converse.
In one variable try $\fbox{$ p(x) = \frac{1}{q+1}x^{q+1} - \frac{1}{2} x^2$}$
Then $p'(x) = x^q - x \equiv 0$, the derivative is identically zero.
This function is not constant $p(0)=0$ and $p(1) = 1 - \frac{1}{2} \neq 0$.
I've been thinking about what it means to be "tangent" to a surface $f(x,y,z)=0$ in finite characteristic. In differential geometry we could consider a function $(x(t), y(t), z(t))$ and take the derivative of $P(x,y,z)$ in the "direction" of the line tangent going through the curve.
\[ \frac{df}{dt} = \frac{df}{dx} \frac{dx}{dt} + \frac{df}{dy} \frac{dy}{dt} + \frac{df}{dz} \frac{dz}{dt} =
a \frac{df}{dx} + b\frac{df}{dy} + c\frac{df}{dz} = 0 \]
This is a linear equation to define which "directions" are "tangent". In these directions we could define the derivative of our polynomial
\[ a \frac{dP}{dx} + b\frac{dP}{dy} + c\frac{dP}{dz} \]
For varieties and schemes, there is a notion of Zariski Tangent Space when more intuitive geometric notions over $\mathbb{C}$ no longer hold.
We are really looking at residue classes of polynomials modulo functions that vanish identically on that surface. $\mathbb{F}_q[x,y,z] / (f)$.
The prime ideals $\mathfrak{p}$ in this ring are "points" on your surface. You define a maximal ideal of "O(1)" functions $\mathfrak{m} = \mathfrak{p}A_{\mathfrak{p}}$. Your tangent space is (quite succinctly) $\mathfrak{m}/\mathfrak{m}^2$.