This is not an easy question to answer. But you can say a few things.
First, it really depends on who you ask and from what tradition that person is part of. It is also possible that a person will not believe in heaven at all. In this case, you will not go to heaven, because there is no such thing in that person's worldview or theology.
Second, if you ask people of the major religions of the world, their answer will differ greatly. However, we can summarize their answers by making two points. First, most people will say that you can only go to heaven by trying your best, or to have your good work outweigh you bad works. In the end, God decided based on how you live.
Second, Christianity is a notable difference, because they say that it is not possible to save yourself. Hence, their view of heaven is based on the words of Christ. Faith in what gets you a ticket to heaven in this framework.