I want to find the second center of $G=D_8 \times C_2$, where $D_8$ is the diheral group of order 16.
I'm having a hard time seeing how you would go about finding the preimage of $Z(G/Z(G))$ under the canonical epimorphism $\pi:G \to G/Z(G)$.
I'm not sure if there is a better method that one can use here.
Also, side question, is there a method to find this using GAP?
Let's use the regular notation, and call your group $D_{16}\times C_2$.
Now $D_{16}$ is the dihedral group of order $16$, containing a cyclic subgroup of order $8$ (let's say generated by $a$) and an involution that inverts $a$ (let's call it $b$).
The center of $D_{16}$ is just the power of $a$ that -- when inverted -- is equal to itself. Thus the center of $D_{16}$ is generated by $a^4$.
The quotient $D_{16}/Z(D_{16})$ is still generated by $a$ and $b$, but the image of $a$ (let's call it $\bar{a}$) has order $4$ now. That is, this quotient is $D_8$.
The center of this quotient is generated by $\bar{a}^2$, because mod $4$, $2$ and $-2$ are the same. Back up in $D_{16}$, this means $Z_2$ is generated by $a^2$.
Thus $Z_2(D_{16}\times C_2) = \langle a^2\rangle\times C_2$.