probability-combinatorics problem I am having trouble with a specific type of combinatorics problem, so if you could please explain it in detail like you are explaining it to a 5 year old I would be grateful.
For example: $n$ persons threw their hats in the box. Box is shaken so that probability of picking each hat is the same. Find the probability that exactly $k$ persons will get their own hat.
I think you can see what type of problem I am struggling with, it is where both objects are different(in this example it was that we had $n$ different people and $n$ different hats, it could be $n$ different balls and $n$ different boxes etc.)
In the solution they use generalized form of theorem that says 
$$P(A \cup B)=P(A)+P(B)-P(A \cap B)$$ 
Now, I understand what this theorem means, but not really how it is applied. 
Thanks in advance.
 A: Presumably, after the box is shaken, people each take one hat out of the box.  Any way of taking the hats out of the box can be described as a permutation (consider each person as having a number on their shirt and on their hat numbered $1$ through $n$, have the persons stand in a row after getting their hat according to the number on their shirt.  The numbers as read on the hats is our permutation).  Each permutation is stated in the problem to be equally likely to occur.
Before worrying about probability, let us first count in how many ways this can be done.
For exactly $k$ people to get their correct hat back out of the box, that means that the remaining $n-k$ people got a different hat than they started.  If we were to ignore the $k$ people who did get their correct hat for now, we count how many ways the $n-k$ people could have their hats shuffled around so that none of them got their correct hat back.  This is what is referred to as a derangement.
The number of derangements on $n-k$ elements is notated as $!(n-k)$ and can be found to be equal to 

$$!(n-k)=(n-k)!\sum\limits_{i=0}^{n-k}\frac{(-1)^i}{i!}$$

As alluded to in your post, how this formula is come to is as a result of the principle of inclusion-exclusion.
Let $A_1,A_2,A_3,\dots,A_{n-k}$ be the events where $A_i$ is the event that person $i$ did get their own personal hat back.  We have then $!(n-k)=|\bigcap\limits_{i=1}^{n-k} A_i^c|$ which by De'Morgans can be rewritten as $=|S_{n-k}|-|\bigcup\limits_{i=1}^{n-k}A_i|$ which by inclusion-exclusion expands further as $=|S_{n-k}|-|A_1|-|A_2|-\dots-|A_{n-k}|+|A_1\cap A_2|+|A_1\cap A_3|+\dots - |A_1\cap A_2\cap A_3|-\dots \pm |A_1\cap\dots\cap A_{n-k}|$
Each term in the above expansion can be calculated, for example $|A_1\cap A_2|$ is the number of permutations where both $1$ and $2$ are fixed points.  Approaching by multiplication principle, we just need to choose how to arrange the remaining $(n-k-2)$ numbers which can be done in $(n-k-2)!$ ways.  Taking into account the number of each type of term which occurs, there are $\binom{n-k}{1}$ terms with only a single event appearing, there are $\binom{n-k}{2}$ terms with two events intersected appearing, there are $\binom{n-k}{3}$ terms with three events intersected appearing, etc... we can make the algebraic simplifications necessary to arrive at the formula highlighted above.

As for your specific problem, again, for exactly $k$ people to get their correct hat back, that means that we choose which $k$ people those are and then choose a derangement of the remaining $n-k$ hats.  There are $\binom{n}{k}\cdot !(n-k)$ such ways for this to happen.  Converting this to a probability then, we divide by the number of elements in our sample space, which is $n!$ to get the probability that exactly $k$ people get their correct hat back as being $$\binom{n}{k}\cdot \frac{!(n-k)}{n!}$$
