There are four uses:
The subject and the object are the same, so it comes in the place of the objective pronoun:
I hurt myself slicing carrots.
Used to emphasize, after the subject:
I myself made the cake. (it can be omitted without changing the sentence meaning)
Meaning alone (used with by):
I live by myself. (= I live alone.)
Meaning without help:
I have to do my homework by myself. (I have to do my homework without anyone �s help.)
In this last case, by can be omitted:
I have to do my homework by myself. or I have to do my homework myself. (without help)