Why won't the Sun set for days at N66.2 which is below the arctic circle?
From the PyEphem Quick Reference Guide:

Rising and setting are sensitive to atmospheric refraction at the
horizon, and therefore to the observer’s temp and pressure; set the
pressure to zero to turn off refraction.

It seems likely that, if you're using the default settings, the result returned is including atmospheric refraction, giving the results you would expect to see at the location, where the sun is visible even though a direct line to the disc of the sun would put it below the horizon.

Image is from &quot;What is Refraction of Light&quot; by By Konstantin Bikos and Aparna Kher at timeanddate.com