Your eye is able to perceive light and visual stimuli because of the way it directs light onto the retina. When light enters the eye through the transparent cornea, it passes through the pupil onto the lens. The lens then focuses the light in a specific way onto the retina, a thin layer of tissue underneath of the sclera that surrounds the back of the eye. The retina picks up the visual stimuli of this light through the many photoreceptors present in its membrane, and then passes it on as a message down the optic nerve to the brain, where it is interpreted.
Inside of the cavity of the eye you have a significant amount of fluid, called interocular fluid. This is a vitreous liquid that further helps direct the current of light from the lens to the retina, while also providing enough pressure to maintain the shape of the eye while providing it with elasticity. As you age (or sometimes because of genetic factors), this liquid becomes less homogenous. As a result, microscopic fibers and proteins have the tendency to clump up and form small aggregates in the uneven parts of your inner eye. If these aggregates pass in front of the beam of light that the lens directs to the retina, they will cast a shadow. Your brain will interpret this shadow as either a “floater” or a “dark region,” depending on the size and density of the aggregate in question. Floaters are putatively NOT, however, small organisms gliding across the surface of your eyeball.