I thought about running electric underground because I've had training on how to install solar panels, electrical sub-panels, and how to do load calculations and properly size wires and conduits per the National Electric Code, but its too far away from the house to go through all the effort to trench the yard just to lay wire to the chicken coop. I did it for my detached garage. I run an extension cord to the coop just in the winter. Its a outdoor rated cord and I plug it into an outlet on the side of my house that has the ground fault buttons that will shut off the outlet if there's a short (like the outlets in newer bathrooms). In the coop on the ceiling is a small 3 outlet power strip. The chickens cannot reach any of it.
In one outlet, I have a timer plugged in. The timer has an outlet on it. What ever is plugged into the timer gets activated at the time you program in. I plug the light bulb into the timer. I have a small round base for the bulb to screw into and the base has 2 prongs to go right into the outlet.
In the second outlet, I plug in a device called a Thermo Cube . Its a temperature sensing outlet that has an outlet on it (2 outlets actually). It would turn on what ever you plug into it at 35 degrees and turn it off at 45 degrees. Its Thermo Cube model TC-3. Other models have different temp set points like 70 and 78 degrees, so if you go this route, use model TC-3. For heating the water last winter I used a home made heating device known as a cookie tin water heater (search it on this site, lots of info and pics about it, easy to make). It worked very well and kept the water from freezing when the over night temps were in the low single digits. The water container I had was only 3 or 5 gallons. I have a much bigger water contain now so I plan on using something else.
It might sound like a jumbled mess, but its not too bad. The chickens could only reach the one wire coming down from the roof to the cookie tin heater but they never bothered to peck at it or do anything to it. I wrapped that wire with plastic flexible automotive conduit just to give them an extra layer to go through and I would visually check it when I refilled the water to see if they were pecking at it and destroying the plastic shielding but they never bothered it.