Dead insects on window ledge

Why is it I always see dead insects on window ledges? Do they go there to die? would it have anything to do with the heat of the sun?

Most insect navigate by means of light. They travel either by moving towards the sun/moon or by keeping it in a set position relative to their body so they move in straight lines. Most insects also move towards light simply because that’s how they have evolved to find open space to navigate in. Glass windows stuff all that up because they permit light but not movement. Insects that are staving and trying to get out of your house fly towards the light but can’t get through the glass and unsurprisingly end up dying in the window sill. Nothing to do with theat, simply that they were tryiong to fly to a better locatioon and the glass stopped them. Insects lack the intelligence to understand glass.