The best way to earn fame is to publish posts that other people find interesting and engaging. Being original and funny, on-topic, and engage in discussions with other users are great ways to earn a lot of fame from comments.
Note that your votes on your own post and comment do not affect your fame. You can only earn fame from votes from other users. In other words, you cannot earn fame simply by posting and commenting – other users must vote for your posts and comments.
Don't strive to gain as much fame as possible. Think of fame as a reward and an indicator of how useful and interesting you have been.
In general, for 1 upvote of your post you will receive 1 fame point, and for 1 upvote of a comment – 0.5 points, but fame isn't a 1:1 relationship with the number of upvotes you get. In fact, your fame will always be lower than the number of ratings due to internal algorithms that protect users from cheating and manipulation of ratings, and can reduce the weight of suspicious or massive votes.