How is the boolean expression for mux2 and mux4 deduced?
It's pretty intuitive, actually.  Based on the states of a and b, one of the 4 terms of a'b'A + ab'B + a'bC + abD will have a chance of being true.  If ab=00, only the first term can be true, and only if A is true.  If ab=01, then the output is true iff B is true, and so on.

The 2-mux would be a'A + aB.