Up to level 20 playing WoW costs nothing. This is the Starter Edition and it is very limited (no guilds, trades, etc). After that you need to pay for game time (via subscription or game cards or later even via ingame gold).
For playing up to level 110 you only need an active subscription. You do not need to buy an extra game or expansion.
As stated in the Blizzard Store:
- Subscription includes levels 1-110.
- Subscription includes levels 1-60 in World of Warcraft® Classic.
If you want to play the whole game you'll need to buy the latest expansion. Currently this is Battle for Azeroth, which allows you to play all the way up to level 120 and its endgame features. In order to play it you need an active subsciption or game time (you can even buy game time with ingame gold).
Pre-purchasing upcoming expansions (Shadowlands is available for pre-purchase) is not necessary. It's only worth it, if you want the extra goodies that come with the purchase. Other than that you can just buy them shortly before their release to have them available right from the start.