As many have said before me, being genuine and true to yourself helps. However try to read someone and see how they act around you, small tips can go a long way in identifying what they feel comfortable with. Don't start conversations with over saturation or inappropriate topics; that'll sink you fast. Instead focus on asking them how they're day was and listening to them, people will tell you a lot about them if you let them and that'll open a door for conversation. Of course be aware that some people don't like talking about themselves and they may end up feeling worse off so try to read their confidence in that.
Be yourself.
Each person has a different character and character, there is a point where someone needs others because of his shortcomings and gives his strength to help others. If we continue to be someone else we think is good for others, then we just hurt ourselves and deceive others. Over time, people will be aware of the differences in our former nature with the present. That's what usually makes others lazy to hang out with us.