We can look for the derivative by definition:
$$g'(0) = \lim\limits_{h\to0}\frac{g(h)-g(0)}{h} = \lim\limits_{h\to0}\frac{g(h)}{h}$$
However, the way the function is defined is not very convenient for us to find the limit, because it is defined in terms of an arbitrary number $k$. That's why we will try to define the function in terms of $x$ only. Note that the condition
$$|x| \in \left( \frac{1}{k+1}, \frac{1}{k} \right]$$
after playing around with the equivalent inequalities (with $x\neq 0$), is equivalent with the condition
$$\frac{1}{|x|} \in [k, k+1)$$
How can we express the function $g(x)=(-1)^k/k^2$ in terms $x$ only?
We can use the floor function. Note that the function $\lfloor x \rfloor$
is defined as the largest integer not less than $x$. With that in mind, it is easy to see that $k=\lfloor 1/|x| \rfloor$. Now the function can be written as
$$g(x)=\frac{(-1)^{\lfloor 1/|x| \rfloor}}{\lfloor 1/|x| \rfloor^2}$$
Let's get back to the limit. Looking at the form of $g(h)/h$, we can intuit that this limit is zero. We shall prove this by definition. Namely, we must show that for all $\epsilon>0$, there exists $\delta>0$ such that
$$0<|h|<\delta \implies \left|\frac{g(h)}{h}\right|<\epsilon$$
Since
$$\left\lfloor \frac{1}{|h|} \right\rfloor \geq \frac{1}{2|h|} \implies \left\lfloor \frac{1}{|h|} \right\rfloor^2 \geq \frac{1}{4h^2}$$
for all sufficiently small $h$ (say for $|h|<\eta$), we have that
$$\left|\frac{g(h)}{h}\right| = \frac{1}{|h|\cdot\lfloor 1/|h| \rfloor^2} \leq \frac{4h^2}{|h|}=4|h|$$
For this to be smaller than $\epsilon$, it suffices to choose $\delta<\min\{\epsilon/4,\eta\}$.
Thus, we have proven that $$g'(0)=\lim\limits_{h \to 0} \frac{g(h)}{h}=0$$
and $g$ is differentiable at the point $x=0$. $\ \ \rule{5pt}{5pt}$