Note: I am not Korean. So, there could be errors. But this is what I've accumulated so far.
Which ones are gerunds, "other forms" of a verb, and complementizers?
(으)ㅁ and 기 are the two forms here that differ the most. In short, 기 nominalizes a verb into a noun/action in a progressive state. Thus, it can be considered the gerund of Korean. Here is an example:
- 쇼핑객으로 이렇게 붐비는 백화점에서 쇼핑하기가 너무 힘들다. Shopping at a crowded (dept.) store like this is too difficult.
On the other hand, (으)ㅁ and 는 것 nominalize a verb into a more "frozen" state. In terms of (으)ㅁ, we can produce actual dictionary entries through such nominalization. Examples are the following:
- 꾸다 / 꿈 (dream), 추다 / 춤 (dance), 아프다 / 아픔 (pain, suffering), 어둡다 / 어두움 (darkness)
As a comparison, we can take (꿈을) 꾸다 and apply both (으)ㅁ and 기:
- 꿈 - a dream (the entity itself that is produced when one dreams)
- 꿈을 꾸기 - dreaming (a progression of the action)
~는 것 doesn't produce dictionary entries from nominalizing verbs, but it does carry the notion of "the act of ..." which directs its focus more on the concept of an action. Thus, it can be viewed similarly with (으)ㅁ.
In terms of complementizers, English to Korean translations aren't always "injective" as we'd like it to be. Fortunately for your example
Ensure that it is done
this could be a translation: (whatever must be done)이/가 다 끝났다는 것을 보증해라.
When should I use which one?
This is a rather difficult question. Only because there is a distinct set of nuances that separate all three. I'd like to quote Korean Grammar in Use: Advanced for its view on (으)ㅁ vs. 기:
(으)ㅁ
- Can be used as a sentence ending.
- Used for things that are already know or that have already occurred.
- 물건이 모두 팔렸음을 보고했다. I reported that everything was sold.
- Since this is commonly seen in written language, particles cannot be omitted.
기
- Cannot be used as a sentence ending (although, it can be used in things like memos: 숙제 하기, 집을 청소하기, 등등)
- Used for things that are expected or unfinished or to indicate the progression of an action
- 물건이 다 팔리기를 희망하고 있다. I hope that everything gets sold.
- Unlike (으)ㅁ, particles can be omitted. 그 친구는 만나기(가) 어렵다.
As for 는 것, I'm sort of reluctant to go into detail as to when it replaces (으)ㅁ and 기. However, in many cases, it can replace either:
- 이 음식은 먹기가 불편하다 ==> 이 음식은 먹는 것이 불편하다.
- 인생의 행복은 돈이 많고 적음에 있지 않다 ==> " " 적은 것에 " "
However, do note that there are idiomatic/fixed expressions like ~기 위해서, ~기 후/뒤/다음에, ~(으)ㅁ으로 인해서, ~(으)ㅁ으로써, etc.. where the nominalizer used cannot be replaced.
Edit 1: I found a page containing a certain case where 는 것 and 기 can be seen differently when replacing each other. Take this statement:
"먹기"가 좀 더 "먹는 행위"를 나타내는 반면 "먹는 것"은 먹는 행위보다는 "먹다"라는 단어가 가지는 의미를 명사화한 것 입니다.
먹기 is more of the actual action itself, while 먹는 것 is more "to eat" or the "act of eating" as I said before.
Because of this, 아침을 먹기가 시작했다 is correct while 아침을 먹는 것이 시작했다 isn't. You don't start the "act" of something like in English: "Let's start the act of eating!". It sounds weird.
So here's another comparison.
아침을 먹기는 건강에 좋다.
This sentence is incorrect (or at least, the person who made this example up thought it was). This is because the action of eating breakfast itself isn't what's considered healthy. It's the fact that it is good for you[r health] to eat breakfast. But that's not what 아침을 먹기 is referring to.
On the other hand:
아침을 먹는 것은 건강에 좋다.
In its literal form, this is "The act of eating breakfast is healthy". It still sounds weird. But given all this talk about notion and the act of doing something, it makes more sense that the notion of eating breakfast can be considered healthy rather than the actual act.