For systems where dimensions are large enough (no smaller then typically 20 to 40 microns), light can be considered to propagate in a ray like behavior. This concept is well known from geometrical optics. A ray travels through a medium in a straight line until it reaches an interface to another material. At that interface it will reflect and refract proportionally to the Fresnell law. The direction in the new medium is defined by law of Snellius and the incidence angle (angle between ray and norm to the interface).
This principle seems simple enough for one ray. In case you want to consider one million rays al emerging form a given source shape, each traveling trough different materials of different shapes it becomes impossible to calculate by hand.
A ray trace program like ASAP will perform this task for us keeping in mind as many reflected and/or refracted rays as we desire. By positioning detectors at a point of interest we can analyze light distributions, polarization, color, radial distribution, etc... of the original source after it traveled through the optical system.