In order to learn something by observation, you must pay attention to the action being performed. Although it sounds a bit obvious, noting the entire execution of a behavior is critical if you plan to imitate it. A complete observation of how the behavior is performed will allow your subconscious to "work on it," increasing your chances of copying the behavior when desired.
The ability to visualize sets human beings apart from animals. People also have a sense of time, and differentiate between the past, present and future. A human is capable of observing and learning a new behavior without immediately performing it. For example, if you watched a video on how to perform a new dance step, you might not get up and try it out at your desk, but you could probably recreate it reasonably well at your next party.
The perceived risk or reward of a behavior makes a big difference in the likelihood of imitation. For example, if you observe your sibling stealing a cookie from the cookie jar and getting away with it, you would learn that it is possible and you are likely try it yourself. However, if you witness your sibling stealing and getting caught and punished, you would probably be less likely to imitate his behavior.
A person's motivation will affect her likelihood of imitating a behavior. For example, if a student with a desire to be popular sees the well-liked kids all wearing blue shirts, it is very likely that the student will also begin wearing blue in an attempt to gain popularity. If you have a strong desire to learn a new language, the knowledge that a friend has just signed up for French classes might inspire you to do the same.