How to add Google Programmable search to WordPress

Writing it all down while it's fresh in my memory, for future reference:
How to add Google search to your WordPress website
(and Why I think that's a good idea )
100% plugin-free solution is welcome, but this is the best I've managed so far (will look into it further when I find the time).
Detailed info about providers whose services I've used:
BikeGremlin web-hosting reviews