@kendalls5216292 Disclaimer :- ✌😊 I am not a SLING expert . But still I would like to point out few things I know . As much as I know.
Lets take your question one by one
if I look at /libs/foundation/components/parsys there is a child node parsys.jsp.
Does any jsp file get executed? - Yes , it does. Much before the entire stack was changed to HTL, we were that old guys with a lot of JSPs. So a lot of components in the /libs/foundation/components still uses JSPs for rendering . Why ? for backward compatibility (I think that's the right word 🙄). There might be a lot of legacy projects still running on them , or quite a few projects in which they might not have completely migrated ut still using some of these components. So yes , these JSPs execute.
Or what declares that that jsp file should be executed? - To exactly answer that one , you have to go through the sling resolution . A better start would be https://issues.apache.org/jira/browse/SLING-387 here. It exactly defines how sling resolves a component. So when you hit a content node in the browser , lets say /content/we-retail/en/us/home.html , the first thing which sling looks for to execute and deliver your content is a property called sling:resourceType under your home node. This resourceType in 90% scenarios will be pointing to a cq:Component in your repository. Now as for any rendering logic, Sling also need to define a rendering logic for its components. And that what its main Job is to. So, as per its definition and sling resolution principles , the JSP gets executed in the order it should be.
May be a little reading on SLING might help https://sling.apache.org/documentation.html also Script-resolution https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html
A similar kind of explanation can be found here -
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/template-component-can-t-o...
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/sling-resource-resolution-...
Updated :- https://issues.apache.org/jira/browse/SLING-278 this was the ticket for sling resolution and inheritance. I have updated the correct ticket details for sling resolution
Hope this helps and gives little bit of idea.
Thanks
Veena