When a note is placed on the staff its head indicates its position, e.g.:
When the note head is below the middle staff line the stem points upward and when the head is above the middle line the stem points downwards. A note placed on the middle line (D) can have its stem pointing either up or down.