Solving Hardy Weinberg problems
Here is a tutorial to perfectly understand Hardy-Weinberg Rule! If you feel like you just need a brief reminder, you can skip the text until the section In short... and try out the exercises just to check your understanding.
Terms you should know a priori
I will not define the following terms, so make sure you understand them

locus
allele
(relative) frequency
Homozygosity and Heterozygosity

What is the Hardy-Weinberg rule?
Hardy-Weinberg rule (HWr) describes a relationship between allele frequency and genotype frequencies. I will present the maths later.
Alleles and Genotypes frequency
Let's assume we have a bi-allelic (two alleles) locus. The possible alleles are called A and B.
Notation for genotype frequencies
Note that I will use a slightly unusual notation on purpose.
Let $f_{AA}$ be the frequency of the homozygous individual caring the allele A on both haplotype (both chromosome). Let $f_{BB}$ be the frequency other homozygote. Let $F_{AB}$ be the frequency of heterozygote which inherited the A allele from the mother and the B allele from the father. Finally, $F_{BA}$ is the frequency of heterozygotes which inherited the B allele from the mother and the A allele from the father.
Most of the time people write $f_{AB}$ (or similar notation) to designate all heterozygotes irrespective of whether the A allele comes from the father or the mother. In this answer, I make the difference of which parent gave which allele. I will instead note $f_{het}$ the frequency of all heterozygotes. Therefore $f_{het} = f_{AB} + f_{BA}$. Similarly, I will note $f_{hom}$ the frequency of all homozygotes. Therefore, $f_{hom} = f_{AA} + f_{BB}$.
Notation for allele frequency
Unlike the above, I will use a class notation here.
Let the frequency of the A allele be $p$ and the frequency of the B allele be $q$.
All genotype frequencies must sum to 1
Of course, if you add up the frequency of all types of individuals in a population, you should reach 1 (or 100% if you prefer). Per consequence,
$$f_{AA} + f_{AB} + f_{BA} + f_{BB} = f_{hom} + f_{het} = 1 $$
is our first important result.
Problem 1

There is 20% of heterozygote in the population, what fraction of the population is homozygote?

Answer: (hover to see the answer)

 $f_{hom}=0.8$ (or $f_{hom}=$80%)

Problem 2

There are 10% of AA individuals and 15% of BB individuals in the population, what fraction of individuals are heterozygotes

Answer:

 $f_{het} = 0.75$ (or $f_{het} =$ 75% )

All allele frequencies must sum to one
The same is true for the allele frequency, they must sum to one. This is even easier than before. Using the above notation it means:
$$p + q = 1$$
You will note that an obvious consequence of this result is that $1-p = q$ is also true. This is the second important result.
Problem 3

The frequency of alleles which are the A allele is 0.3. What is the frequency of the B allele?

Answer:

 $q = 0.7$

Hardy-Weinberg equilibrium
Let's now talk about HWr.
HWr assumptions
HWr makes a number of assumptions that I will not detail them here. Please have a look at the post Assumptions of Hardy-Weinberg rule for more information.
HWr exercice without explanations
Here are exercises that one may consider they come too early in my explanations. Don't worry too much if you can't solve them but please take the time to try solving them. Please do not try to apply known formulas about HWr, only use your logic and the above formulas (allele frequencies must sum to 1 and genotype frequencies must sum to 1)
Problem 4

In a population, one observes that 20% of the population is homozygote for the A allele and that there are no heterozygous individuals at all. What is the frequency of the A allele?

Answer:

 $f_{A} = 0.2$

Below is a drawing of the population (assuming N=20 individuals) to help understand the answer.
AA | AA | AA | AA | BB | BB | BB | BB | BB | BB | BB | BB | BB | BB | BB | BB | BB | BB | BB | BB
Problem 5

In a population, one observes that all B alleles are present in heterozygote only. The frequency of heterozygotes is 0.1. What is the frequency of the A allele?

Answer:

 $f_{A} = 0.95$

The hard part here is to first calculate $f_{B} = 0.05$. Let's draw the population (assuming only N=20 individuals) and that will likely help you out.
AA | AB | AA | AA | AA | AA | AA | AA | AA | AA | AA | AB | AA | AA | AA | AA | AA | AA | AA | AA
HWr formula
As said above, HWr describes a relationship between allele frequency and genotype frequency
Without much explanations, here are these relationships
$$f_{AA} = p^2$$
$$f_{AB} = pq$$
$$f_{BA} = pq$$
$$f_{BB} = q^2$$
Therefore,
$$f_{hom} = p^2 + q^2$$
$$f_{het} = 2pq$$
To build your intuition, you should try to consider for yourself extreme cases where one allele is fixed (fixed=reached a frequency of one). For example, what are the expected genotype frequencies when

$p=1$ and $q=0$?
$p=q=0.5$?
$p=0$ and $q=1$?

How HWr is often expressed
Mixing up the idea of the above relationships and the fact that all genotype frequencies must sum up to one, one can also write
$$p^2 + 2pq + q^2 = 1$$
As by definition $q = 1-p$, it is also common to replace write
$$p^2 + 2p(1-p) + (1-p)^2 = 1$$
Why do these relationships make sense?
Problem 6

Imagine you are drawing alleles in a population of alleles like you would draw cards from a deck of cards! You draw a single allele. If the frequency of A allele is $p$, what is the probability of drawing an A allele?

Answer:

 $p$

Similarly, the probability of picking a B allele is $q=1-p$.
Problem 7

Ok, now. Assuming that the fact that you already drew an allele does not change the allele frequency in the population (because the population is very large), what is the probability of drawing two A alleles in a row?

Answer:

 It is $p$ for the first draw and $p$ for the second draw. The overall probability is therefore $p \cdot p = p^2$

Here we go! You just solved why $f_{AA} = p^2$. You can apply the exact same logic to find out $f_{BB} = q^2$.
Now the probability to first draw a A allele and then a B allele is $pq$. Therefore, $f_{AB} = pq$. The probability to first draw a B allele and then a A allele is $qp=pq$ as well. Therefore, $f_{BA} = pq$.
Exercise
Problem 8

In a population with two alleles for a certain locus, A and B, the allele frequency of A is 0.7. What is the frequency of heterozygotes if the population is in Hardy-Weinberg equilibrium?

(You will note I renamed the alleles to match my above notation)
Try to solve this problem yourself now!
Answer:

 It is a given that $p=0.7$. The question is what does $f_{het}$ equals to?
 Let's start by calculating $q$. $q=1-p=0.3$.
Then, let's calculate the the genotype frequencies.
$f_{AA} = p^2 = 0.49$.
$f_{BB} = q^2 = 0.09$. 
$f_{het} = 2pq = 0.42$.
Here we go! We've got the answer. Let's make sure the answer makes sense by summing up the genotype frequencies to ensure we get 1.
$f_{hom} = f_{AA} + f_{BB} = 0.58$
$f_{hom} + f_{het} = 0.42 + 0.58 = 1$
All good!

Problem 9

At a bi-allelic locus, the allele A is dominant over the allele a. The phenotype associated with the dominant allele is present in 10% of the individuals of the population. What is the frequency of the allele A?

Answer:

 The genotypes coding for the phenotype associated with the dominant alleles are AA and Aa. Therefore, $f_{AA} + f_{Aa} = 0.1$ and therefore, $f_{aa} = 0.9$.
 The frequency of the allele a is $p = \sqrt{f_{aa}} = \sqrt{0.9} ≈ 0.95$.
 To conclude the frequency of the allele A is $q = 1 - p = 1 - \sqrt{0.9} ≈ 0.05$

Problem 10
You will find a HW problem involving selection at this post.
Problem 11
You will find a HW problem involving a population of triploids individuals at this post.
Problem 12
You will find a HW problem for sex-linked loci at this post

In short...
Here is a summary for a bi-allelic locus
Allele freqs sum up to one
$$p + q = 1$$

Genotype freqs sum up to one
$$f_{AA} + f_{AB} + f_{BA} + f_{BB} = f_{hom} + f_{het} = 1 $$
You will note that most often when people write $f_{AB}$, they just mean $f_{het}$ and therefore don't make the distinction between $f_{AB}$ and $f_{BA}$.

Hardy-Weinberg rule
Note that Hardy-Weinberg rule holds only under a number of assumptions (such as random mating, panmictic population, no selection, ...) that I have not detailed here (see Assumptions of Hardy-Weinberg rule for more information).
$$f_{AA} = p^2$$
$$f_{AB} = pq$$
$$f_{BA} = pq$$
$$f_{BB} = q^2$$
Therefore,
$$f_{hom} = p^2 + q^2$$
$$f_{het} = 2pq$$

Putting all together
The whole thing put together is often expressed as
$$p^2 + 2p(1-p) + (1-p)^2 = 1$$