A king has n children, at least one of them is a daughter. What’s the probability that all of them are daughters? A king has n children, at least one of them is a daughter. What’s the probability that all of them are daughters?
So far I've considered the case of 3 children, which gives a probability of 1/7.
But I'm confused about how to generalise this?
 A: Let $X$ be the count of daughters among the $n$ offspring.   Assuming the probability that a child will be a daughter is $1/2$, then the count will have a binomial distribution: $X\sim\mathcal{Bin}(n, 1/2)$
$$\mathsf P(X=x\mid X\geq 1) = \dfrac{\mathsf P(X=x)}{1-\mathsf P(X=0)}\;\big[x\in\{1..n\}\big]$$
Where $\mathsf P(X=x)=\dbinom{n}{x}{\big(\tfrac 1 2\big)}^n\;\big[x\in\{0..n\}\big]$
So $\mathsf P(X=n\mid X\geq 1) $ $= \frac{{\big(\tfrac 1 2\big)}^n}{1-{\big(\tfrac 1 2\big)}^n} \\ = \frac{1}{2^n-1}$ 
Which as true blue anil has suggested can also be obtained by considering that of the $2^n$ possible outcomes, $1$ is the favoured event, and $1$ is the complement of the condition—"the event that can be ruled out".

Note: $\big[\text{conditional}\big]$ is the Iverson notation for an indicator function; having a value of $1$ when the conditional is true but $0$ otherwise.
A: The appropiate formula would be 1 /(2^n - 1) assuming at least one child.
The top would be the available number of good outcomes which will always be 1.  Because there is always only one way to have all children be girls.  
The bottom would be the total number of outcomes which would be 2^n - 1.  There are 2^n possible combinations of children; however, you will always be able to exclude one combination which is the combination of all boys.
A: The sample space has $2^n$ equi-probable points, assuming P(boy) = P(girl) = $\frac12$
Knowledge that there is at least one girl implies that one particular outcome is ruled out.
Continue....
A: Assuming that the probability of a child being a girl is 1/2, which is not quite true biologically but close ...
Every child is either a boy or a girl. (Old fashioned idea, but I'm sticking with it.) So with n children there are 2^n possibilities. 
If "success" is defined as all girls, then that is exactly 1 of the possible combinations. So, ignoring the "at least one girl" requirement for the moment, the probability of all girls is 1 / 2^n. e.g. with 1 child, 1/2; with 2 children, 1/4; 3 children, 1/8; 4 children, 1/16; etc.
But we don't want to consider all possibilities, but only those where at least one child is a girl. So the denominator should not be 2^n, but only those where at least one of the children is a girl. This is an easy special case, though: just as there's only one way for all the children to be girls, there's only one way for none of the children to be girls: they must all be boys. So of the 2^n possible combinations, the number that include at least one girl is 2^n-1.
So the probability is 1 / (2^n-1). e.g. 2 children, 1/3; 3 children, 1/7; 4 children, 1/15; etc. Note that if there's only one child, this formula gives 1/1=100%, which makes sense: If you have only one child, and at least one of them is a girl, then that one child must be a girl and they are "all" girls.
** Update **
Okay, apparently an unclear point here.
If there are two children, that gives 2^2=4 possibilities: BB, BG, GB, and GG. Note that there is only one way each to have all boys or all girls, but 2 ways to have one boy and one girl. So, considering all cases, not just the ones where at least one child is a girl, the probability of all boys is 1/4, all girls is 1/4, and one of each is 2/4 = 1/2.
Similarly with 3 children the possibilities are BBB, BBG, BGB, BGG, GBB, GBG, GGB, GGG. The probability of all boys is 1/8, all girls is 1/8, 1 boy and 2 girls is 3/8, and 2 boys and 1 girl is 3/8. That is, there's more than one way to have two boys and a girl -- the girl could be first, second, or third -- but there's only one way to have all boys or all girls.
A: It surely depends on how we know there will be a girl. If we don't know anything more than the fact that one of the children is a girl, then it's 1/(2^n)-1).
For two children we have a set of children containing a girl and the other child. Now ignoring the restriction we know that most parents that don't have B/B have G/B - 2/3rds to be precise. Therefore, having built that probability tree (equal chances of BB GB BG GG) if we apply the restriction all we would do is say "well that rules out BB". So we get 1/3rd chance of getting GG.
If the king kept having children until he had a daughter and then maybe had more then all we know about his children is that if he didn't have any girls in his first n-1 children then he has a girl for his last child. That doesn't help us in the all-girl situation at all, as building a probability tree of n=2 we get:
Boy/girl=50/50
Boy? Second child is a girl but it doesn't matter.
Girl? Continue
Boy/girl=50/50
Therefore it's unchanged, the probability is 1/4. The fact that there is no further branch after the first node doesn't affect what we know about the final probabilities, since our events are no longer independent, with a special case of n=1 in which case the probability is 1.
If instead we live in a region rife with kings, and we've decided to move to the land of one that has a daughter, then we just take the usual distribution and distribute that probability across the board - we wind up with a 1/3 chance of picking a a king with 2 daughters! That's 1/((2^n)-1), same as when we don't know anything more than that one child is a daughter.
One more case: If we know that a particular child is a girl, it is actually more information. Going back to the first case with BB BG GB GG we ruled out BB. If we know the first child is a girl, we can further rule out BG, so we're left with GB and GG - 50% chance of getting all-girls.
The key here is to recognize how much information you actually get and where it applies (something I failed to do with the first two cuts of my answer...)
A: 1/(2^(n-1))
It's the same as calculating the probability of a sequence of unanimous coin flips, except you've guaranteed one of the outcomes, hence the "n-1".
A few examples
He has 1 kid: 1/2^0 = 1. You guaranteed a girl
He has 2 kids: 1/2^1 = 0.5. One is a girl, the other has 1/2 chance to go either way.
He has 10 kids: 1/2^9 = 0.001953125. Same logic applies as the other 2 examples.
A: It should be uncontroversial that, for $n > 0$,
$$ P(\text{all girls} \mid \text{at least one girl, n children}, X)
= \frac{P(\text{all girls} \mid \text{n children}, X)}{1 - P(\text{all boys} \mid \text{n children}, X)}$$
simply from the definition of conditional probability. Here $X$ is a placeholder for whatever extra hypotheses you want to impose on the problem, if any.

Given the OP's answers, the OP is presumably working with a model where
$$ P(\text{all girls} \mid \text{n children}, X) = 2^{-n} $$
$$ P(\text{all boys} \mid \text{n children}, X) = 2^{-n} $$
and consequently,
$$ P(\text{all girls} \mid \text{at least one girl, n children}, X)
= \frac{1}{2^n - 1}$$
There are reasons to consider other models; e.g. the ratio of male to female births and the king's desire to have a male heir could affect these probabilities.
In fact, the very fact we are considering the question can influence how we should model the probabilities; e.g. if our smartaleck friend posed the problem and bet us a dollar that the children were all girls, I would expect him to have some inside knowledge rather than posing a 'fair' question.

Some of the answers try to avoid the counterfactual argument; i.e. they include the hypothesis "$\text{at least one girl}$" in the common hypothesis $X$. One important thing to note when trying to do the analysis this way is that the genders of the children are not identically distributed, independent random events when subjected to this condition.
There is a short proof by contradiction that this should be so; assume that they are independent and identically distributed. Then,
$$ 0 = P(\text{all boys} \mid \text{at least one girl, X})
 = \prod_{c \text{ is a child}} P(c \text{ is a boy} \mid \text{at least one girl, X}) $$
and consequently we infer $P(c \text{ is a boy} \mid \text{at least one girl, X})  = 0$ for each child $c$.
Now, we can get independence if we drop the identically distributed condition; specifically if one of the children is singled out (call it $g$) and we are told that $g$ is a girl.
We don't have this in the given problem; it's presented in a way such that all of the king's children are equal. However, there are variations on the problem where one particular child is special. e.g. "The king introduces you to his daughter Samantha. What is the probability her siblings are all girls too?"

One could continue on to to break the symmetry by splitting the children up onto "one special child that is a girl" and "the other children"; a common mistake here is to mistake this approach with the "special child" version. Here, the special child is not given to us by the problem, but is introduced by our choice to break the symmetry, and that choice must be properly accounted for.
For notational simplicity, suppose that $X$ includes the hypotheses that there are $n$ children and that there is at least one girl. For any particular child $c$, it is interesting to ask for
$$ P(\text{c is a girl} \mid \text{c is an "other" child}, X) $$
and we can compute that this is equal to
$$ \frac{P(\text{c is an "other" child} \mid \text{c is a girl}, X) P(\text{c is a girl} \mid X)}{P(\text{c is an "other" child} | X)} 
$$
Depending on our modeling, we might expect


*

*$P(\text{c is a girl} \mid X)$ is slightly greater than $1/2$ (because we've ruled out the all boy case)

*$P(\text{c is an "other" child} \mid X) = \frac{n-1}{n}$

*$P(\text{c is an "other" child} \mid \text{c is a girl}, X)$ should be a lot less than $\frac{n-1}{n}$


and consequently, the probability that any particular "other" child is a girl should be a lot less than $1/2$.
Incidentally, I believe the genders of two different "other" children shouldn't be independent variables either.
A: Its generalisation can be P(n,1)+P(n,2)+....+P(n,n) where p represents permutation abd their addition is no of ways of having children.
So probability is P(n,n)/total no of ways of having children which is the above sequence
A: I agree with the answer getting the least traction here 1/(2^(n-1))
In the question there is a guarantee of 1 daughter regardless of n.  You have to assume one of the children a daughter in the equation, figuring out which child is the daughter is meaningless.  
No matter the number of outcomes you can just assume the first child is a daughter.
A: I agree with both user3263864 and torg514.  The answer is 1/(2^(n-1))
If the king has only 1 child, there is a 100% probability that it is a girl  1/(2^(1-1))=1/(2^0)=1/1=1
If the king has a 2 children, there is a 100% chance that one is a girl and a 50% chance the other is a girl:  1 X 1/2 = 1/2
If the king has a 3 children, there is a 100% chance that one is a girl and a 50% chance the each of the other two are girls:  1 X 1/2 X 1/2 = 1/4
etc.
So to summarize, when n = 1, there is a probability of 1 that all of the kings children are girls.  When n = 2, the is a probability of 1/2 that all of the kings children are girls.  When n = 3, the is a probability of 1/4 that all of the kings children are girls. Etc.
The formula that characterizes this result is P(all girls) = 1/(2^(n-1))
Another way to look at it is to identify the possible combinations.  For clarity, I will use a capital G to indicate the one child that has a 100% chance to be a girl.
If 1 child:  G --> 1/1 chance all children are girls
If 2 children: Gg or Gb --> 1/2
If 3 children:  Ggg, Ggb, Gbg, Gbb --> 1/4
IF 4 children:  Gggg, Gggb, Ggbg, Gbgg, Ggbb, Gbgb, Gbbg, Gbbb --> 1/8
