Safari search bar searches with random search engines Most of the time, when I search something using the Safari search bar, it gives me results from Google. Sometimes however, it uses the default search engine of my ISP. How can I fix this and what are the reasons it is happening?
Assuming that everything's on the up-and-up with your ISP, this kind of behavior typically is a result of some connection failure between your ISP and Google ("Hmmm, I can't find Google, so I'll route this to our search engine instead.") - and in my experience it's most often due to DNS issues. 

One easy way to figure out if it is due to DNS issues is change what DNS servers your network connects to. Two options are Google itself (8.8.8.8 and 8.8.4.4 for IPv4 service or 2001:4860:4860::8888 and 2001:4860:4860::8844 for IPv6) or OpenDNS (208.67.222.222 and 208.67.220.220 for IPv4 or 2620:0:ccc::2 and 2620:0:ccd::2 for IPv6).

Depending on the current DNS servers your computer/network is currently using, you could even see faster lookup performance.