Summon the Empress of Light by killing a Prismatic Lacewing in the Hallow after Plantera. Night or day fight, arena, every attack, the Terraprisma and all drops.
You summon the Empress of Light in Terraria by killing a Prismatic Lacewing, a rare rainbow butterfly that flies around the surface Hallow at night once Plantera is dead. She appears as soon as the Lacewing dies, at any time of day.
She is an optional Hardmode boss. Her attacks are fast and colorful but well telegraphed, and her fight is usually treated as a post-Golem challenge. Fight her at night: in daylight she becomes enraged and every attack kills you in one hit.

Notable drops:
Prismatic Lacewings only spawn after Plantera has been defeated, in the surface Hallow, between 7:30 PM and midnight. Only one can be around at a time, and it gives off a soft rainbow glow, so look for a small moving light over the Hallow.

You have two choices when you find one:
A caught Lacewing disappears almost at once if you release it outside the Hallow, so release it inside the Hallow and hit it right away. If your arena is somewhere else, release it straight onto a damaging spot that stays in place, like the flame pillar of a Clinger Staff or a Rainbow Gun rainbow.
Note: Lacewings you have caught still work in another world, even one that is not in Hardmode yet. The Guide to Critter Companionship stops you from hurting critters, which prevents an accidental summon while you build in the Hallow.
The Empress of Light can be fought at any time, but the time decides how she behaves:

If you only damaged her during the day, she leaves at 7:19 PM. That gives you from 4:30 AM until 7:19 PM to win a Terraprisma attempt. If you hit her at night and the sun comes up, she simply calms down again when night returns. Summoning her between 7:19 PM and 7:30 PM makes her leave at once.
Build the arena over the surface Hallow, or close enough that a released Lacewing reaches a damaging spot quickly. Make it wide: a long strip of Asphalt Blocks with two or three layers of platforms above it gives you room to outrun her lances and rainbows.
Mobility is everything here:
She is not immune to useful debuffs, so Ichor, Betsy's Curse and Daybroken all add damage. For a daytime attempt, skip defense and regeneration altogether: Campfires, Heart Lanterns and dodge accessories don't help when every hit is lethal, so spend those slots on damage.
The Empress of Light has 70,000 health in Classic, 98,000 in Expert and 124,950 in Master, with 50 defense. She hovers in place for 3 seconds after spawning and then runs a fixed list of attacks.
At half health (35,000 / 49,000 / 62,475) she vanishes, reappears above you with four tendrils on her back, and her defense rises to 60. The gaps between attacks get shorter, and two new lance attacks join the list: waves of lances that sweep across the whole screen from each side, and 16 lances fired at your position from behind you.

Her pattern never changes, so learning it is the whole fight. In the first phase she always opens with Prismatic Bolts, then a Dash, then Sun Dance. Stay level with her or a little below her, because she zips above you between attacks.
Keep moving in one direction during the lance waves and only turn after the lines appear. Most deaths come from running into a lance line that was aimed at where you were heading.
She always drops one of four weapons, each with a 25% chance:

She also drops 5 to 15 Greater Healing Potions, 3 Prismatic Dye (25%), the Empress Wings (6.67%, or 10% from the Treasure Bag), the Rainbow Cursor (5%), the Stellar Tune (2%), the mask (14.29%) and the trophy (10%). The Terraprisma drops every time she is killed with all of her damage taken in daylight.

The Expert and Master Treasure Bag always holds the Soaring Insignia, which gives infinite flight time, 75% faster acceleration and 7.5% more movement speed. Master Mode adds the Empress of Light Relic and a 25% chance at the Jewel of Light pet.
You can fight her right after How To Summon Plantera, but most players wait until after How To Summon Golem and often after How To Summon Duke Fishron, whose Fishron Wings make her dash and lances much easier to avoid.
The Terraprisma is a common goal before How To Summon Moon Lord, so many players beat her once at night for the Soaring Insignia and then come back in daylight with better gear.