Where to install libraries such as hdf5
If you follow those instructions, the package will install everything to /usr/local. This is a recommended place to install user-compiled software because it's already in your PATH, doesn't need elevated permissions, and a lot of stuff breaks if it's not in either /usr or /usr/local . If you open the DEST directory that's created before the pkgutil step, you'll see where everything gets installed. It's the --PREFIX=/usr/local in the configure step that decides the path relative to which things get installed.

Incidentally, both those packages can be found in homebrew which, in my opinion, is a better way to manage these things and you may find more straightforward. After you install homebrew:

brew install szip hdf5