Respect is earned through your consistency, good character, comportability, values you add to peoples lives. Meanwhile to some extent , respect could be automatic regarding circumstances that surrounds you e.g official environments, families (where you have to relate with inlaws and all, etc)