What is a malakh? There are a number of opinions, I will discuss one of the most famous, that of the Rambam in the Moreh.
I've included the pertinent parts of the extensive discussion of the subject of malakhim in the Moreh, down below. To summarize the Rambam's points, Malakh HASHEM can refer to a variety of entities, forces, thoughts and/or persons who are carrying out the will of Elohim in the world. The malakh Hagar encountered was either a Bat Qol or a person/entity sent by Elohim to deliver a message and/or carry out instructions (in this case, to save her and Yishmael). Likewise the flaming bush and cloud were either forces or entities directed by Elohim to manifest in the physical world, so acted as conduits between Moshe/am Yisrael and Elohim.
Yet these can also be described as HASHEM directly, as can be understood through a simple analogy: when one receives an important letter from person A, the recipient is not engaging in dialogue with the messenger (the mailman, or the letter itself) but with person A who caused the message to come to be and the messenger to deliver it. Or speaking with someone via skype, one talks to the other person on the line, rather than directing attention to the device which is the vehicle for that transmission. In the same way, the Tanakh (and we) can speak of HASHEM "doing" or "saying" this or that, even though we know that it is being carried out via intermediaries ("malakhim").
MN:
In all parts of the Tanakh, every act of Elohim is described as being
performed by malakhim. "Malakh" means" messenger", hence everyone who
is entrusted with a certain mission [from Elohim] is a malakh. Even
the movements of the natural world are sometimes due to the action of
a malakh, when such movements serve the purpose of the Creator, who
endowed it with the power of performing that movement: e.g., "Elohim
has sent His malakh, and shut the lions' mouths so that they have not
hurt me" (Daniel 6:22). Another instance may be seen in the movements
of Bilam's ass, described as caused by a malakh. The elements are also
called malakhim: "Who makes winds His malakhim, flaming fire His
ministers" (Tehillim 104:4). There is no doubt that the word "malakh"
is used of a messenger sent by humans, e.g.,"And Yaakov sent malakhim"
(Bereshit 32:4), of a navi, e.g.,"And Malakh HASHEM came up from
Gilgal to Bochim" (Shoftim 2:1), "And He sent a malakh, and has
brought us out of Egypt" (Bemidbar 20:16). It is also used of Ideals,
perceived by neviim in prophetic visions, and of humanity's animal
powers, as will be explained in another place.
...
In other passages
Chazal expressed it more firmly: "Elohim does nothing without
consulting the host above". On the words, "what they have already
made" (Qohelet 2:12), the following remark is made in Bereshit Rabba
and in Midrash Qohelet: "It is not said 'what He has made,' but 'what
they have made'; hence we infer that He, as it were, with His court,
have agreed upon the form of each of the limbs of a person before placing
it in its position, as it is said, 'He has made and established you'"
(Devarim 32:6). In Bereshit Rabba 51 it is also stated that wherever
the term "and HASHEM" occurs in the Tanakh, HASHEM with His court is
to be understood. These passages do not convey the idea that Elohim
spoke, thought, reflected, or that He consulted and employed the
opinion of other beings... They only show that all parts of the
Universe, even the limbs of animals in their actual form, are produced
through malakhim: for natural forces and malakhim are identical.
...
We may find a confirmation of the opinion that the natural and
psychological forces of an individual are called malakhim in a
statement of Chazal which is frequently quoted, and occurs originally
in Bereshit Rabba 78: "Every day Elohim creates a legion of malakhim;
they sing before Him, and disappear." When, in opposition to this
statement, other statements were quoted to the effect that malakhim
are eternal ... the reply has been given that some live forever,
others perish; and this is really the case for individual forces are
transient, whilst the genera are eternal and imperishable. Again, we
read (in Bereshit Rabba 85) in reference to Yehudah and Tamar: "R.
Yokhanan said that Yehudah was about to pass by [without noticing
Tamar], but Elohim caused the malakh of lust to present itself to
him." Human urges are here called a malakh. Likewise we frequently
meet with the phrase "the malakh set over a certain thing.'' In
Midrash Qohelet (on Qohelet 10:7) the following passage occurs: "When
a person sleeps, their nefesh speaks to the malakh, the malakh to the cherub."
The intelligent reader will find here a clear statement that human
imaginative faculty is also called "malakh" and that "cherub" is used
for human intellectual faculty.
(Proposition 26, chapter 6)
...
From the rule laid down by us that prophecy requires preparation, and
from our interpretation of the homonym "malakh" you will infer that
Hagar, the Egyptian woman, was not a nevit; also Manoah and his wife
were no neviim: the speech they heard, or imagined they heard, was
like the Bat Qol, which is so frequently mentioned by Chazal, and is
something that may be experienced by people not prepared for prophecy.
The homonymity of the word "malakh" misleads in this matter. This is
the principal method by which most of the difficult passages in the
Tanakh can be explained. Consider the words "And Malakh HASHEM found
her by the well of water" (Bereshit 16:7), which are similar to the
words referring to Yosef, "And a man found him, and he was erring in
the field" (37:15). All the Midrashim assume that "man" in this
passage means a malakh.
(Id., chapter 42)