What software communities[1] are you a part of and who are you helping in those communities? Do you contribute there in the form of (code, documentation, blog posts, conference talks, helping juniors, etc)?
At 40 I think you do well to have a decent network in a focused set of communities of people you've mentored, supported, and worked with. IE folks in a specific discipline, project, thing where you might expect there to be community conferences around or other community institutions. You'd be a mainstay there, always looking to help juniors / new people, paying it forward everywhere you can, etc.
Then finding the next job is about those relationships, continuing to help them through the years, etc
If someone is looking for a job at 40 and they haven’t already built a big network, it’s not helpful to tell them they should build one. But if you’ve been working for about 20 years you probably do have at least some friends or colleagues you can (and should) reach out to for opportunities.
At 40 I think you do well to have a decent network in a focused set of communities of people you've mentored, supported, and worked with. IE folks in a specific discipline, project, thing where you might expect there to be community conferences around or other community institutions. You'd be a mainstay there, always looking to help juniors / new people, paying it forward everywhere you can, etc.
Then finding the next job is about those relationships, continuing to help them through the years, etc
Don't focus on "F-You money", focus on an "F-You network" https://softwaredoug.com/blog/2024/05/08/build-an-f-you-netw...
1 - community can mean discord/slack communities, subreddit, projects, on social media, having coffee 1-1 with people, etc etc