The difference is in the reference point of time where the speaker perceives him/herself to be.
I will do my homework by 6 p.m.
The time is sometime before 6pm, and the speaker is simply asserting an intention to do the homework before the stated time.
I will have done my homework by 6 p.m.
The time when this sentence is spoken is the same as before, but the speaker is moving the reference point to some time in the future after 6pm. Effectively s/he is saying that "When we next speak (at sometime after 6pm) to see what my homework status is, I will be able to say that I have done my homework".
The future perfect tense is useful when discussing something else that is to happen. For example
"Let's go to the cinema tonight. The movie starts at 7pm and it takes
half an hour to get there. Can you come?"
"I think so. I will have done my homework by 6pm, which gives us half
an hour to eat something before we need to leave. So yes, let's go."
Using this as a reference, these sound OK, with the exception of "have to" but only because repeating "have" twice like that sounds a bit jarring.
I ought to have finished the homework by the end of the week.
I have to have finished the homework by the end of the week.
I shall have finished the homework by the end of the week.
I have heard this before, it sounds a bit awkward but makes sense.
I had better (typically "I'd better") have finished the homework by the end of the week.
I have also heard this before, it sounds quite awkward but still makes a bit of sense.
I have got to (typically "I've got to") have finished the homework by the end of the week.
This ...
I must have finished the homework by the end of the week.
I must not have finished the homework by the end of the week.
sounds like you are just discovering you have or have not done the homework, rather than using "must" to communicate a requirement or obligation.
However, usually all these sentences are arranged like this, which sounds much more natural to me.
I ought to have the homework finished by the end of the week
And all the modals "work", including the ones not mentioned above, if you keep the sentence like that:
I can(n't)/could(n't)/must(n't)/might (not)/may (not) have the homework finished by the end of the week.
(Even though "I must not have the homework finished by the end of the week" - meaning I am required to not have my homework finished by the end of the week - is a peculiar situation to be in - that would be the right way to say it.)
Best Answer
We use it when we need it, and don't really notice.
But it is not clearly needed in either of your examples. Simple predictions are ordinarily expressed with a will + infinitive future:
But if your context establishes that such an event acts as 'background' for some other predicted event, a future perfect construction is called for. For instance:
You only use the future perfect if your story includes some future event—not just a date—to which the fp event is necessarily anterior.