In the old days, they took the grade B contour map of each affiliates' signal. Any county that is covered, even partially, is marked. If any part of any marked county is within 75 air miles of the non-soldout stadium, then that affiliate is blacked out. I don't think that the process has changed since the switch to digital.
This can lead to bizarre situations.
A few years ago, CBS had two games in a particular time slot. One was Indianapolis/New England, and the other was Houston at Oakland. Three CBS affiliates in the entire country showed Houston at Oakland. They were in Houston (primary Texans market), Beaumont, and Bryan (the Texans' two secondary markets).
Now, Bryan is part of the Waco/Temple/Bryan DMA. Waco and Bryan are about 90 miles apart, so the idea of them being in the same DMA is absurd, but they are. DirecTV and Dish customers with locals get both KWTX (which was showing Indy/NE) and KBTX. In fact, NFL Sunday Ticket blackouts here are based on what's showing in Waco. I have friends with Sunday Ticket who get their Bryan locals over the air. DirecTV blacked out the Indy/NE game for them. They couldn't get KWTX OTA, so they were screwed.
KWTX and KBTX are "sister stations." They have the same ownership. The local cable company reached an agreement with KWTX to carry them for one day so they could show the Indy/NE game. The NFL blocked it. How the NFL can prevent a cable company for airing a CBS affiliate in its own DMA I don't know, but they did it.
Now our Fox affiliate is a low-power repeater of Waco's Fox affiliate. This means that they will show the Cowboys over the Texans. A lot of the time, they will show a random NFC East contest over the Texans. I am subject to blackouts and exclusivity for the Texans on CBS, but my Fox affiliate sometimes doesn't even bother to show them.
Luckily for me, I couldn't care less about the Cowboys or Texans.