Question: I have such confusion with the word *than*, check out these examples: 

> 
> I would prefer to have beaten him up than have been beaten up by him.
> 
> 
> I prefer to die than kill someone
> 
> 
> 

Should the preposition *to* be placed after *than* if I wanted to put the verb in the infinitive form? Like, *I prefer to die than to kill*? Or should it be like the first example? No preposition necessary? 

And when talking about verbs ending in *-ing*: *I would prefer doing this than doing that* or *I would prefer doing this than do that*?

Answer: 
What you're describing is yet another example of *ellipsis*, in this case, where common prepositions are left out of sentences when they add no significant information. Either way is correct:

> 
> I would prefer to die than (to) kill someone.
> 
> 
> 

Other examples:

> 
> She said she would prefer to go shopping than (to) see a movie.
> 
> 
> I'd much prefer to stay home in bed than (to) go to work today.
> 
> 
> 

If comparing two activities, then the most common construction is to make them both the same form. It doesn't really matter whether you pick the infinitive or the gerund:

> 
> I prefer skiing rather than surfing.
> 
> 
> I prefer to ski rather than to surf.
> 
> 
> 

However there are various other ways you can structure this kind of statement, that can be different depending on if you use the infinitive or the gerund:

> 
> I prefer skiing to surfing (and not "I prefer to ski to to surf")
> 
> 
> I prefer to ski, not to surf (or "I prefer skiing not surfing)
> 
> 
> 

Note: Your first example is *somewhat* unusual English. "Prefer" usually refers to things you would *like* to do, not things you would *prefer* to avoid. In this case "would rather" is more natural:

> 
> I would rather die than have to kill someone
> 
> 
> She said she would rather [make out](http://dictionary.cambridge.org/us/dictionary/english/make-out) with an orangutan than go on another date with him.
> 
> 
>
I prefer to die than kill someone.

The sentence is grammatical. You can also use "to" after than, but it's less common. Look at the following sentence:

I prefer to walk than/rather than to catch the train (The Free Dictionary).

As for the sentences:

I would prefer doing this than doing that.

I would doing this than do that.

You use 'than" to join infinitives, not two -ing forms or an -ing form and an infinitive. So the correct sentences are:

I would prefer doing this to doing that.

I would prefer doing this rather than that.

I would prfer to do this than (to) do that.

I would prefer to do this rather than that.