What purpose do the opening(s) serve in diapsid and synapsid skulls?
It is believed that originally the holes evolved to give the jaw muscles a place to expand into as they contract. They evolved as the the  otherwise larger jaw muscles are trapped between the bones and cannot contract properly. I say "believe" because the original function is still debated, and it is not something that can be easily tested. 

Diapsids likely evolved from early synapsids, however the evidence is tentative at best and it is just as likely that they both evolved independently from anapsids. 

Birds are diapsids. However many modern birds have lost the bony partition between the two holes, separating them by cartilage and soft tissue only. Just as some mammals have lost the bony partition between the jaw muscles and the orbit. Additionally in many mammals and birds the expansion of the braincase makes it harder to identify the holes for the laymen as they are pushed down and to the side.