What is the difference between necessary and sufficient conditions? 
*

*If $p\implies q$ ("$p$ implies $q$"), then $p$ is a sufficient condition for $q$.

*If $\lnot p\implies \lnot q$ ("not $p$ implies not $q$"), then $p$ is a necessary condition for $q$.
I don't understand what sufficient and necessary mean in this case. How do you know which one is necessary and which one is sufficient?

It has always been difficult for me to connect the linguistic sense of the terms "necessary" and "sufficient" with mathematics.  However, with practice with the following table, this skill becomes automatic.

I'm assuming you understand the meaning of the implication.  In any case it is helpfull to think about simple example when looking at this table. For example: "If it is raining, then close the window". Then it remains to understand the following.
P is a sufficient for Q. If P is true then Q will be always true (the first line in the table). Note that we do not consider the second line. But as we see in the table Q can be true also when P is false (the third line in the table). So P is "just" a sufficient condition for Q.
Q is a necessary condition for P. It is obvious from the table. P can be true "only" when Q is true (the first line in the table). Note that we do not consider the second line.
About $\lnot A \implies \lnot B$. It is called the contrapositive of the statement $A\implies B$. As you see it is not necessary for you for understanding the "sufficiency" and "necessaty".
