$h$ factor
The factor of $1/h^{3N}$ is a total hack.
The integral over phase space has dimensions, whereas $Z$ only makes sense if it's dimensionless.
The $h$ factors are there to make $Z$ dimensionless.
Suppose you have a system with only one particle in one dimension.
Then the integral in phase space goes over one position variable, $dq$ and one momentum variable $dp$.
The dimensions of position times momentum, i.e. $dpdq$, is called action.$^{[a]}$
So, to make $Z$ dimensionless in the one-particle one-dimensional case, you have to divide by something with dimensions of action.
Planck's constant is a perfectly acceptable choice because it happens to have dimensions of action.$^{[b]}$
However, as much as it's acceptable it's also totally arbitrary and should make you highly suspicious that someone is trying to fool you or not explain what's really going on.
Now, if you go to three dimensions the integral over phase space has three factors of length and three factors of momentum.
Therefore, the dimensions of the integral are $\text{action}^3$.
To get rid of those dimensions you divide by $h^3$.
When you have $N$ particles you have $N$ integrals and so you have $3N$ powers of $h$.
The thing is,when you really come down to it, $Z$ doesn't actually have to be dimensionless.
Whenever you compute anything physical you wind up dividing $Z$ by itself.
Suppose we define $Z$ without the $h$ factors (and without the $N$ factors for now):
$$Z \equiv \int e^{-\beta H(q,p)}\,dqdp \, .$$
Consider the average energy of the system
\begin{align}
\langle H \rangle
&= \frac{1}{Z} \int H(p,q) e^{-\beta H(q,p)} \, dqdp \\
&= \frac{1}{Z} \int - \frac{d}{d\beta} e^{-\beta H(q,p)} \, dqdp \\
&= - \frac{1}{Z} \frac{d}{d\beta} \int e^{-\beta H(q,p)} \, dqdp \\
&= - \frac{1}{Z} \frac{dZ}{d\beta} \, .
\end{align}
The dimensions of $Z$ cancel out!
This always happens.
So, in classical physics the $h$ factors used to remove the dimensions for $Z$ don't really need to be there.
The same thing happens when you deal with entropy.
At first, it seems like it has the wrong dimensions because it's the logarithm of the available phase space volume.
If phase space volume has dimensions you can't take the log!
But when you realize that only ratios of available phase space volumes, and therefore differences in entropy that actually mean anything in a classical system, it's no longer an issue.$^{[c]}$
$N$ factor
The $N$ factor is more interesting.
First, you need to understand the Gibb's paradox.
The basic idea is that if I put a divider in the middle of a box of gas molecules, I cut the available positions of each one in half, so the entropy would seem to be reduced.
Think of it like this: there's less possible ways for the system to be arranged if I add the divider, because molecule $A$ is restricted to one half of the box.
The problem is that I now violated the 2nd law of thermo by reducing the entropy.
Dividing $Z$ by $N!$ fixes this.
The number $N!$ is the number of ways a set of $N$ things can be permuted among themselves.
So, dividing $Z$ by $N!$ is basically saying to treat the states related by swapping molecules with one another as the same state.
You are un-counting states which are related by particle interchange.
Another way to say this is to say that you're treating the particles as "indistinguishable" because a situation with particle $A$ in state 1 and particle $B$ in state 2 is the same as particle $A$ in state 2 and particle $B$ in state 1.
A better way to say this is that the notion of $A$ and $B$ doesn't have meaning, and instead you should just say "the number of particles in state 1 is 1 and the number of particles in state 2 is 1".
This indistinguishibility is really weird in the context of classical mechanics.
Where did it come from?
Why can't we talk about two molecules as having their own identity?
The answers come from quantum mechanics where you find that "particles" are really best thought of as excitations of modes.
I highly recommend reading this other Physics.SE post.
$[a]$: The SI unit of action is the Joule-second. You can think of that as a momentum times a length, as we saw with $dqdp$, or an energy times a time.
$[b]$: Of course, this is not an accident at all, but since we're not really talking about quantum mechanics here I don't get into it.
$[c]$: If someone wants to point out that this is wrong, please do!