Although the sun is at all times above the earth's surface, it appears in the morning to ascend from the north-east to the noonday position, and thence to descend and disappear, or set, in the north-west. This phenomenon arises from the operation of a simple and everywhere visible law of perspective. A flock of birds, when passing over a flat or marshy country, always appears to descend is it recedes; and if the flock is extensive, the first bird appears lower or nearer to the horizon than the last, although they are at the same actual altitude above the earth immediately beneath them. When a plane flies away from an observer, without increasing or decreasing its altitude, it appears to gradually approach the horizon. In a long row of lamps, the second, supposing the observer to stand at the beginning of the series, will appear lower than the first; the third lower than the second; and so on to the end of the row; the farthest away always appearing the lowest, although each one has the same altitude; and if such a straight line of lamps could be continued far enough, the lights would at length descend, apparently, to the horizon, or to a level with the eye of the observer. This explains how the sun descends into the horizon as it recedes.
Once the lower part of the Sun meets the horizon line, however, it will intersect with the vanishing point and become lost to human perception as the sun's increasingly shallow path creates a tangent beyond the resolution of the human eye. The vanishing point is created when the perspective lines are angled less than one minute of a degree. Hence, this effectively places the vanishing point a finite distance away from the observer.
Usually it is taught in art schools that the vanishing point is an infinite distance away from the observer, as so:
However, since man cannot perceive infinity due to human limitations, the perspective lines are modified and placed a finite distance away from the observer as so:
This finite distance to the vanishing point is what allows ships to ascend into horizon and disappear as their hulls intersect with the vanishing point. Every receding star and celestial body in the night sky likewise disappears after intersecting with the vanishing point.
For more information please read Chapter 14 of Earth Not a Globe
In addition to this modified law of perspective the remaining light of the sun bouncing around in the atmosphere will be lost by the non transparent atmosphere. After the sun sets the sky is still relatively illuminated. It takes a couple hours for the deep blackness of the night to set in. The cause of night is simply due to a non-transparent atmosphere. As the sun recedes its light is dimmed and lost to the increasing number of atoms and molecules which intersect the light rays.
Take note that at sunset the sun is already dimmed by an order of magnitude compared to its intensity overhead at noonday. At sunset it is possible to look directly at the sun without a straining of the eye, while overhead at noon looking directly at the sun can be quite painful. This severe reduction of intensity at sunset is a striking example of how the atmosphere can reduce the intensity of an object with distance.
As the sun descends it will create a tangent into the horizon. The perspective lines nearly merge, causing the receding body to appear to collapse in on itself. Next the light of the receding sun is dimmed to blackness by a non-transparent atmosphere.
"At these times it appears close to the horizon where the density of the air differs greatly. The air near the ground is denser than the layer of air just above it, and the layer of air above that is less dense still, and so on upwards until the Earth's atmosphere peters out at some 400 km. Now consider what happens when the Sun is setting. When the Sun is at the horizon, light from the top of the disc is going through the air at a different angle than that from the lower part. So the rays are bent by different amounts before they reach the observer's eye. The result is that the bottom part of the Sun's disc appears to be lifted up. In consequence the Sun's disc appears slightly compressed." - Samuel Birley Rowbotham
Magnification of the Sun at Sunset, or how the sun maintains its size throughout the day.