How to get unblocked
Of course, the first way is to not get blocked in the first place! I've often heard people protest their block when they were clearly doing something wrong. So if you get blocked because you replaced the main page with "aasdkadkj" then my answer to you is "don't do that then".
But even if you act perfectly, there are reasons that you might get blocked. There might be a misunderstanding, or you may have broken a rule that wasn't obvious, or you may have come across an unreasonable admin.
So my first advice is to take an honest look at your actions. Is this really a bad block, or were you doing something you shouldn't have? Look around for pages about the wikia's rules, and check that you understand them. And consider whether this might be a simple misunderstanding, with no bad intent on either side. If there is no clear reason for a block, don't jump to the conclusion that the admin is out to get you!
But whatever the reason, if you want to contest the ban you will need to talk to the admin who banned you. The first question is where you should leave your message. In some cases, you may still be able to use your wall or talk page. If so, it's best to use your wall on the wikia to leave a message, the admin may be watching for it.
If you don't have access to your wall then it's important not to use another account to go back to the wikia. This is likely to be regarded as sockpuppeting and will probably increase your ban rather than remove it!
Instead, you can leave a message on the admin's Community Central wall. This is an emergency route that allows you to talk to the admin in a neutral place. You shouldn't use other wikias for this and drag the conflict into another community's space. That can get you banned from that wikia, or (if you keep doing it) from all of Wikia
If you know you did something wrong, then apologise sincerely and genuinely. But if you've done things wrong before, don't expect an apology to be enough. Saying "I'm sorry, I won't do it again" is good, but it doesn't change that you did do it.
Even if you come to the conclusion that you didn't do anything wrong, and didn't break any rules, you still need to remember to be calm, polite, and prepared to hear the admin's point of view. If you are rude or abrupt, or if you accuse the admin of being corrupt or incompetent, then it's unlikely they will take you seriously or take the time to have a second look
If you are confused about why you were blocked, ask the admin what you did wrong. Again, don't get accusatory, ask in a genuine way for help to understand what happened
Now it's time to talk to the admin about lifting the block. As always, keep it polite and be willing to work with the admin to find a solution. Consider asking for the ban to be reduced rather than removed, that might be something that the admin can agree to.
Be aware that if there have been problems with you in the past, the admin is less likely to agree to change the ban. And, of course, more serious problems are less likely to be forgiven quickly. Even with a careful and polite message with good reasons for a removed or reduced ban, the admin may say "no".
If that happens, you have one more chance. You can contact another admin from the same wikia for a second opinion. This isn't likely to change the reply, because admins usually work closely together and trust each other's judgement, but I have seen it make a difference.
If that doesn't work, it's time to move on. There are a vast number of other wikias you can contribute to, and it's much better to go to one of those until your ban ends than to persist in trying to change the unchangeable. It's better to take your dignity and try your luck with a different community.
These steps won't always work, but it is the best way to try to contest your ban. Throughout it all, remember that the admin's motivation is most likely to be to protect the wikia. By being polite, reasonable, and understanding, you are showing them that you can return to the wikia without harming it or its community. Be good to the wikia, and its admins will be good to you.