Through a process called : Modelling
Study shows that positive attitude will always attract people around you. Which mean that if you show positive attitude toward people, you became the model fragment in people's perception as someone that could bring benefit to them. Since humans are gifted with the ability to perceive what's good for us, it is very likely that people will copied your positive behaviour