Why does 空 have a fourth tone reading in 空格, but a first tone reading in 空调, 空气 etc And, more broadly, is there a pattern when words like 空 have the same pronunciation but different tones, depending on the word?
Generally, first tone means it is related to air/sky/vaccuum/or stressing its emptiness.

空调-air conditioner，空气-air,天空-sky 航空-aviation 真空-vaccuum，空虚-emptiness

Fourth tone usually means something related to blank/room or space/emptiness, and stressing that it can be used or filled

空格-space 空当-free time or space，填空-fill in the blank 
空白-blank/空缺-vacancy/空隙-slot/空出时间
(may not be appropriate translation,sorry)

Another interesting example:

这个房间是空的。 This room is empty.(first tone)

哪个房间空出来？ Which room is available(so that I can use)?(fourth tone)