This phase II trial studies how well pembrolizumab, chemotherapy, and radiation therapy work with or without surgery in treating patients with anaplastic thyroid cancer. Monoclonal antibodies, such as pembrolizumab, may interfere with the ability of tumor cells to grow and spread. Drugs used in chemotherapy, such as docetaxel and doxorubicin hydrochloride, work in different ways to stop the growth of tumor cells, either by killing the cells, by stopping them from dividing, or by stopping them from spreading. Radiation therapy uses high-energy x-rays to kill tumor cells and shrink tumors. Giving pembrolizumab, chemotherapy, and radiation therapy with or without surgery may kill more tumor cells and work better in treating patients with anaplastic thyroid cancer.