that is, it has a flat deck over a room...
a flat roof is something you want to avoid, because water does not run off and roof will deteriorate over time, then you have a leak that you have to deal with it right away, in the middle of night, or in the middle of a storm. That's the kind of house I will never buy.
what I suspect is that this leak occurs at multiple of locations around the perimeter of the flat roof, most likely due to improper installation of the rails, that compromises the water proof of the roof, or due to aging. It is more evident for the woodpecker's holes because water leaked behind the vertical wood piece and it rots inside, that moisture attracts insects, and then the woodpecker.
the other leak behind the downdrain and gutter can be due to stuffed drain and water overflow, but my first suspection is still a leak from the top. You have a leak that has been going for about at least 3 years. I don't think it is the overflow gutter.
Once you fix the source of leak, the repair is relatively easy. But I warn you that the same kind of leak from the nail holes that secure the railings can cause another leak in a different location.