The innermost integral is with respect to $x$, treating $z$ as a constant.
Since this is the case, you might as well go with: $$ x = z\tan\theta \implies \text{d}x = z \sec^2\theta \text{ d}\theta \qquad (*)$$ $$ x = 0 \implies \theta = 0, \ x = z \implies \theta = \dfrac{\pi}{4} $$
$$ \int_{0}^{z} \dfrac{z}{x^2+z^2} \text{ d}x = \int_{0}^{\pi/4} \dfrac{z}{z^2 \sec^2\theta} \ z\sec^2\theta \text{ d}\theta = \dfrac{\pi}{4} $$
In the case of the indefinite integral, we have that:
$$ \begin{aligned} \int \dfrac{z}{x^2+z^2} \text{ d}x \ \overset{(*)}= \ \int \dfrac{z}{z^2 \sec^2\theta} \ z\sec^2\theta \text{ d}\theta \ = \int z \dfrac{1}{z} \text{ d}\theta \ & = \ z \dfrac{1}{z} \theta + \mathcal{C} \ = \ z \dfrac{1}{z} \arctan \left( \dfrac{x}{z} \right) + \mathcal{C} \end{aligned} $$