Hadamard gate is desribed by a matrix

$$
H = \frac{1}{\sqrt{2}}\begin{pmatrix}
1 & 1 \\
1 & -1
\end{pmatrix}.
$$

If you apply the Hadamard on $|0\rangle$ you will have a superposition
$$
H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ 1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle).
$$
This superposition is denoted $|+\rangle$.

Application on $|1\rangle$ leads to a superposition
$$
H|1\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ -1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle).
$$
This superposition is denoted $|-\rangle$.

Hadamard gate is inverse to itself, i.e. $HH = I$ (you can verify this by direct matrix multiplication). Hence $HH|0\rangle = |0\rangle$ and $HH|1\rangle = |1\rangle$, i.e. there is no change in input state. This can be generalized to any input state $|\psi\rangle$, i.e. $HH|\psi\rangle = |\psi\rangle$.

Now, concerning your particular problem.

In the first case $|1\rangle$ is returned after application of $H$ this means that input (B) had to be $|-\rangle$. Since $|-\rangle$ is result of application of another $H$, its input (A) had to be $|1\rangle$.

In the second case $|0\rangle$ is returned after application of $H$ this means that input (B) had to be $|+\rangle$. Since $|+\rangle$ is result of application of another $H$, its input (A) had to be $|0\rangle$.

Because a probability of measurement either state $|0\rangle$ or $|1\rangle$ is 50 % for both $|+\rangle$ and $|-\rangle$, you cannot distinguish $|+\rangle$ and $|-\rangle$ based only on probabilities, you also need phases (in plain words plus and minus before $|1\rangle$ in the superpositions). Hence you need "ket" notatiton and not only probabilities.

Hi and welcome to Quantum Computing SE. Please find below the answer. I also added solution to your particular problem. – Martin Vesely – 2020-04-20T07:18:01.103