Web Service is a piece of software that makes an application available to the internet.

It means, any web application which want other applications to interact with their system can develop it's web service and make it available to the internet, other applications can consume these services to interact with their system.

For example, suppose, if MakeMyTrip wants to allow other websites to book flight tickets from MakeMyTrip but on their websites, then MakeMyTrip will develop it's web service and make it available to other websites so that they can use it and build a functionality of booking tickets from MakeMyTrip on their website.

This was just an example to explain you what is web service and what is it's purpose.

Web Service methods are exposed by end points. End Point is nothing but a simple URL that other application uses to consume web service.

Web Service uses two protocols majorly.

SOAP - SOAP (Simple Object Access Protocol ) is an XML based protocol that is followed by Web Service. This protocol uses XML based envelop to transfer information from one application to another.
Example - WCF, ASMX Web Service etc.

REST - REST is an architectural design and it stands for Representational State Transfer (ReST). Mainly It works over HTTP. REST APIs are much lighter than SOAP based APIs. Modern web application or mobile application prefer to develop their APIs in REST style.
Example - WEB API (ASP.Net), NodeJS APIs etc.