We can break up this problem into three disjoint possibilities.
- They share a row
- They share a column
- They share a diagonal
So, the number of ways for them to share a row:
Choose one of the eight rows.
Choose two of the eight squares of the row.
Total probability that they share a row: $$\dfrac{\dbinom{8}{1}\dbinom{8}{2}}{\dbinom{64}{2}}$$
Similarly, they share a column with the exact same probability.
Finally, let's figure out the probability they share the same diagonal.
There are $4$ diagonals each with exactly $2,3,4,5,6$ or $7$ squares squares. There are two diagonals with exactly eight squares.
So, the total number of ways to arrange two queens on the same diagonal:
Choose the size of the diagonal, choose the diagonal, choose two squares of the diagonal.
$$\dbinom{2}{1}\dbinom{8}{2}+\sum_{k=2}^7 \dbinom{4}{1}\dbinom{k}{2} = 280$$
So, the total probability that two queens attack each other if they are placed on random squares:
$$\dfrac{8\dbinom{8}{2}}{\dbinom{64}{2}} + \dfrac{8\dbinom{8}{2}}{\dbinom{64}{2}} + \dfrac{280}{\dbinom{64}{2}} = \dfrac{728}{2016} = \dfrac{13}{36}$$
Edit: This answer is different from the textbook's answer. I am not sure what I could have done wrong. It is not possible for two queens to share the same row and the same column as this would imply they share one square. If they share the same diagonal, both their row and column are different, and it is not possible to share two distinct diagonals at the same time. So, each case seems to be disjoint, and thus additive.
Edit 2: I actually verified my answer using a script to brute-force calculate the probability. This script returns "Num Attacking: $728$ Out of: $2016$". Here is the script I used:
Sub Test()
numAttacking = 0
numConfigurations = 0
For a = 0 To 62
rNumA = a Mod 8
cNumA = Int(a / 8)
For b = a + 1 To 63
numConfigurations = numConfigurations + 1
rNumB = b Mod 8
cNumB = Int(b / 8)
If rNumA = rNumB Or cNumA = cNumB Or rNumA + cNumA = rNumB + cNumB Or rNumA - cNumA = rNumB - cNumB Then
numAttacking = numAttacking + 1
End If
Next b
Next a
MsgBox "Num attacking: " & numAttacking & vbCrLf & "Out of: " & numConfigurations
End Sub