If you have, say, 20 posts/pages on your WordPress site, the search functionality that is baked right into your self-hosted WordPress site will probably do a great job. Search is a pretty cool feature to ship with WordPress, truth be told. But as a site grows, you'll find limits. How it works behind the scenes is a touch over my head, but as I understand it, it does a
MySQL LIKE query on your post titles and post content. It tries its best to order by relevance (like if it finds an exact sentence match), then largely orders by date.
If search is super important to your site (here on CSS-Tricks, on-site search gets used a ton) you'll probably look for other options.
TLDR: Jetpack Search is quite good out of the box, customizable, and requires very little effort.