The beginning of a piece of writing is often referred to as a hook. It is, as you say, how the writer gets the reader’s attention in just a few sentences. There are a few different ways to do this, such as to ask a question, make a shocking statement, tell an anecdote, or use a statistic.
One of the most common ways to begin an essay is to ask a question. In fact, it’s so easy and so common as to be trite. You can begin an essay with: Have you ever wondered what happens to water bottles after you throw them away? You might have your reader's attention, but only somewhat. After all, the question is only a fairly boring way of capturing your reader’s attention. It doesn’t require much effort on the reader’s part to think, and it doesn’t require much effort on the writer’s part to write. This is why it is the first hook you were taught to write. It works sufficiently, but you can move on to something more interesting.
Another type of hook is the shocking statement. This can be in the form of a fact or piece of information that your reader is not likely to know that is going to catch most people’s attention. Here is an example to make that water bottle topic a little more interesting.
Americans throw away about 40 billion soft drink cans and bottles every year. Placed end to end, they would reach to the moon and back nearly 20 times. (www.cityofsouthfield.com)
A shocking statement like this would prepare the reader for a persuasive essay on recycling, for example. It prepares the reader for a more interesting essay, and also peaks the reader’s interest. It is better than the simple question because it already gives information makes the reader want to know more. A variation of this is to simply supply a statistic.
Another way to begin a piece of writing is to start with an anecdote. An anecdote is a short personal story. You could, for example, tell the story of a water bottle from the time it is purchased and the five minutes or so it is used to the 450 years it takes for the plastic to break down. This method of beginning with a story means that your reader is interested and emotionally invested from the beginning, and you are on your way to an interesting essay. Now you just have to write the rest!