A camera lens is built from several stacked glass elements. When a strong light source — the sun, a lamp — sits near the frame, some of that light fails to pass straight through the coatings and bounces between the glass surfaces instead. Those bounces trace the aperture's shape into a string of round artifacts, lined up along the straight line connecting the light source to the frame's optical center — that's lens flare.
It started out as a defect lens designers tried to engineer away with coatings, but from the 1970s on, cinematographers began embracing it deliberately — flare signals "shot with a real camera" and lends a scene warmth and realism. Anamorphic lenses' horizontal blue streaks became an iconic look for science fiction for exactly this reason.
Building it in CG or on the web: place several round artifacts along the line from the light source through the frame's center, varying their size and color the farther they sit from the source. Move the light source across the frame and those artifacts need to travel along that same line to keep reading as real.
When to use
Use it when the sun edges into frame outdoors, or in CG/motion graphics when you want to borrow the feel of a real lens. Keep it restrained in dialogue-heavy shots so it doesn't fight legibility.