Ethics is the branch of philosophy asking what we ought to do.
Schools of Thought
Hedonism is a philosophy that says that contentment is the ultimate goal of life. Hedonists believe that whatever option maximizes pleasure is the option that people should rationally choose. But remember helping other people will make you happier and improve your self respect.
Altruism is a philosophy that says that we ought to maximize happiness for all sentient beings. If everyone behaved altruistically, the world would probably be a lot better. Buddhism teaches that we should strive to reduce suffering for all sentient beings.
Asceticism is a philosophy that teaches that we should abstain from worldly goals and pleasures, in favor of reaching religious or spiritual goals. This can lead to people making themselves and those round them miserable in the hope of reward or hoping to avoid punishment in some assumed afterlife.
Ethical Egoism says that we should do whatever benefits ourselves the most, regardless of how it makes other sentient beings feel. Ethical Egoism is a part of Objectivism, the philosophy of Ayn Rand. Those who follow that code are likely to have few friends and to do badly because once people find out how selfish they are few people will help them.
The Rational Basis for Ethics
How do we know which ethical code to follow? What rational justification can we give for whatever moral code we follow? Why be ethical, or be altruistic?
It should be mentioned that the ultimate source of knowledge is intrinsic knowledge, or self-evident truth. When we experience pain, for example, most of us have the intrinsic knowledge that this sensation is intrinsically bad, and that we should avoid things that give this sensation.
Therefore, a code of ethics can be justified by people having the intrinsic knowledge that they should follow said code of ethics. If one is to behave altruistically, one could simply have the intrinsic knowledge that they should behave in that way.