They suggested the 4 type of layout which can be used for predictive search on any website.
You are free to have choose from these suggestion or have any different layout of your need.
And for adding the jquery code for calling.
You can add that code either on search.liquid file or theme.js file. And theme.js will be the best option.
And please make sure you added this script inside the event of adding input in search field.
Please let me know if it was helpful.