First of all, you always use it when the direct object is a person, the preposition a precedes it. For example:
I called my brother last night. Anoche llamé a mi hermano.
Pedro does not like early starts. A Pedro no le gusta madrugarse.
It can also be used if the direct object is a pet and the speaker has personal feelings towards it.
I stroke my grandma’s dog when I see him Acaricio al perro de mi abuela cuando le veo.
HOWEVER If the direct object is not a human or an animal (no personal feelings involved) you do not use the personal a.
I looked at the time Miré la hora
I hugged the dolphin Abracé el delfín
Other cases are the verbs tender and haber. You may be tempted to say: “tengo a dos hermanos” (I have two brothers) but you do not use the personal a after the verb tender even if the direct object is a person. Same goes to haber, for “there are twelve boys on the football pitch” you say “hay doce chicos en la pista"
One common case is when the direct object is an indefinite person. The personal a is not used as:
E.g. I need a doctor Necesito médico
You need any doctor, you don’t know who that doctor will be. However:
Necesito al (a + el) doctor Fernandéz He/She is known. Necesito jardinero.
Hope this helps!