Edit:
After seeing the new question Calculating odds of Minesweeper is this correct?, I realized that I'd made a significant mistake in this answer. See the edit at the end for the correction.
The question cannot be answered locally. The answer depends on the information you've gained in other parts of the board. That information may itself be complicated. In the easier case where that information takes the simpler form of a known number $m$ of remaining mines in $t$ remaining unidentified squares, a solution that assigns $n$ mines to $s$ of the unidentified squares has weight
$$
\binom{t-s}{m-n}\;.
$$
The probability of this assignment for these $s$ squares being correct is this weight, normalized by the sum of the weights of all possible solutions for these $s$ squares.
If $t\gg s$ and $m\gg n$, this can be well approximated as
$$
\binom tm\left(\frac mt\right)^n\left(\frac{t-m}t\right)^{s-n}\;,
$$
which corresponds to your calculation with $p=\frac mt$ and $q=\frac{t-m}t$.
Edit:
Since an explanation was requested, I'll do this for the example in Minesweeper odds for this scenario, 2 different calculations. Let's say we have a total of $t=27$ unidentified squares left, and we know there's a total of $m=11$ mines in them. The local patch that we're assigning solutions to has $s=15$ squares (which doesn't count the grey squares $M$ and $Q$, since we don't know anything about them and aren't assigning mines to them).
So each solution that assigns $n=3$ mines has weight $\binom{27-15}{11-3}=\binom{12}8=495$, every solution that assigns $n=4$ mines has weight $\binom{17-15}{11-4}=\binom{12}7=792$ and every solution that assigns $n=5$ mines has weight $\binom{17-15}{11-5}=\binom{12}6=924$. There are $2$, $3$ and $1$ such solutions, respectively, so the sum of the weights is $2\cdot495+3\cdot792+1\cdot924=4290$, so the probabilities for the solutions are $\frac{495}{4290}=\frac3{26}\approx11.5\%$, $\frac{792}{4290}=\frac{12}{65}\approx18.5\%$ and $\frac{924}{4290}=\frac{14}{65}\approx21.5\%$, respectively.
By comparison, with the approximation $p^nq^{s-n}$ given in the question, with $p=\frac mt=\frac{11}{27}$ and $q=1-p=\frac{16}{27}$, the approximate probabilities come out as $\left(\frac{11}{27}\right)^n\left(\frac{16}{27}\right)^{15-n}$. Here, too, we have to normalize them, so we can drop a common factor of $\left(\frac{11}{27}\right)^3\left(\frac{16}{27}\right)^{10}$, which leaves us with $\left(\frac{16}{27}\right)^2=\frac{256}{729}$ for $n=3$, $\frac{11}{27}\cdot\frac{16}{27}=\frac{176}{729}$ for $n=4$ and $\left(\frac{11}{27}\right)^2=\frac{121}{729}$ for $n=5$. Note that the conditions for the approximation to be good, $t\gg s$ and $m\gg n$, aren't fulfilled, and in fact the approximation gets the order of the weights wrong; it makes the $n=3$ case the most likely and the $n=5$ case the least likely, whereas for the correct weights it's the other way around. The sum (again including the counts of each type of solution) is $2\cdot\frac{256}{729}+3\cdot\frac{176}{729}+1\cdot\frac{121}{729}=\frac{1161}{729}=\frac{43}{27}$, so the probabilities would come out as $\frac{256}{1161}\approx22.0\%$ for $n=3$, $\frac{176}{1161}\approx15.2\%$ for $n=4$ and $\frac{121}{1161}\approx10.4\%$ for $n=5$. So in this case the approximation is in fact quite bad and we should use the exact calculation.
Edit:
The above calculation would be correct if each of the six scenarios were a single solution. I didn't take into account that each scenario actually stands for several solutions in which the mines are distributed within the groups of coloured squares. It's these $104$ individual solutions that need to be weighted.
So we have a total of $4+6=10$ solutions with $n=3$ mines, $18+24+4=46$ solutions with $n=4$ mines and $48$ solutions with $n=5$ mines.
Thus the sum of weights is $10\cdot495+46\cdot792+48\cdot924=85734$, and the probability of each individual solution with $3$ mines is $\frac{495}{85734}=\frac5{866}\approx0.58\%$, with $4$ mines $\frac{792}{85734}=\frac4{433}\approx0.92\%$ and with $5$ mines $\frac{924}{85734}=\frac{14}{1299}\approx1.08\%$.
$$ \frac{\binom{t-s}{m-n}}{\binom tm};, $$
but since $\binom tm$ is the same for all solutions, it cancels in the normalization, so I omitted it and called these modified probabilities "weights".
– joriki Dec 03 '19 at 09:06