according to Freud, all human actions are motivated by the past experiences they had specially in family. Family is the first and the important influences towards children. The experiences with mother and father then continue giving effect on children mental and personality.
all those child experiences especially traumas, irrational wishes, stressful experiences, sexual experiences, etc are repressed in subconscious mind. subconscious mind is part of mind that cannot be easily accessed in conscious condition. it works when one is in dream and slip of the tongue.
there are 3 apparatus involved in the forming of human mental. they are id, ego, and superego. Id works by pleasure principle; it search for pleasure and immediate satisfaction. in opposite of Id, superego works by moral principle and preventing id satisfaction. Ego is between those two oppositional side (id&superego) and it works by reality principle.
in order to survive from the pressure of Id & Superego, Ego develops mechanism which is called defend mechanism. there are some kinds of defend mechanisms such us: repression, displacement, projection, fixation, regression, etc.
More detail information you can download from the link below: