In my 20's and early 30's every job I got was through contacts.
Since then I've been working solo projects at small companies for a number of years. Fun work, but suddenly it's dried up. I don't have any good recent contacts in the tech sector. So I'm competing with 22 year olds, with little to back me up.
So don't do that. Try to keep in touch with former colleagues, and try to be widely-known in your company for doing good work and being easy to work with.
If you're 33, you might get a job using a recommendation from someone who managed you a decade ago. If you're 53, that same person retired years ago and doesn't have any pull to offer. And someone who worked for you 10 years ago can't recommend you easily, because it's hard to "recommend up" to a position above your own.
It's a subtle sort of thing, it's not direct ageism but it's obviously a big hurdle for an older worker.
Stick with big companies. Yes by working at a small co you gain experience picking tech stacks, working on all areas of software, etc. But the ceiling is lower at small companies (only the very hottest couple startups each year notwithstanding). And the experience you gain there (mostly writing simple CRUD apps in various languages) isn't so applicable to larger companies where performance and scalability are the main things they want. So when you hit the glass ceiling of the "small co" sector, you're essentially starting all over when you move to the "big co" sector. That's where I am and it's almost like a career change.
Compare this to a career path at a large co, where you move into senior engineering and the skills you gain are immediately useful when you apply to other large companies. You get free networking and visibility at big companies too, an underestimated fringe benefit.
Also, pick your battles wisely when doing the "keep current on technology" thing. Avoid cute stuff that doesn't have a ton of use outside a very narrow segment (e.g. Haskell, logic programming, blockchain, marginally CUDA), unless you really want to devote your career to it. Also avoid overly-trendy stuff that will be obsolete in five years (JS frameworks, MongoDB). Stick with things that solve real problems that real companies have. To that end, search job boards and see what other large companies are hiring for.
I'm doing the small(er) company thing, and I don't regret it, but I've slowly shifted to larger groups and I definitely feel the difference. Getting exposure to lots of different things is good, but at a certain point being in charge of maintaining the website while you're also building an actual product is just a distraction.
The "current tech" thing is obviously a constant battle for everyone, and it's an important one. Narrow tools can be trouble, flash-in-the-pan frameworks are ugly, and even things like Go can be chancy if you master something valuable but scarcely employed. At the very least, it's obvious to me even early in my career that I need to maintain a couple of mainstream, in-demand skills no matter what I specialize in.
The only advantage of broken comb is that you potentially have lots of middling positions you can apply to. But even for those, you may be rejected as "overqualified" because you know so much other stuff. Besides, who wants to send lots of resumes and do lots of interviews in the pursuit of a middling job? Especially when you know you're way better than the people that you're competing against and losing to.
So, don't fan too far out. Find a concentration that's reasonably mainstream for the foreseeable future and expand your skillset to supplement that. Maybe not as renaissance-man as the typical above-average programmer would hope for, but likely the best career path.
The few that were, I got discriminated against because of my age.
Doh!
[1] They tell me. I can't get too far from the code or its no fun, but I prefer to build teams and work at a high level than to be constantly coding all the time.