The amount of appearance fee you get will be based on 2 main factors:
1. How much interest and positive publicity will you bring - are you an interesting story, have a big following, etc.
2. How substantially are you likely to contribute to the race itself. Are you a legit contender, will you likely be on TV in the lead pack and factor in the race. Largely this is based on past races.
You get some athletes who get paid appearance fees based largely on 1 of these 2 factors and very little on the other. The people who made major appearance fees are the people who score high in both areas (i.e. Meb).