Energy is restored over time at a rate of 1 energy point every 3 minutes even when you aren't playing. The timer under your energy points shows how much time is left until you restore another energy point. Once you reach your maximum, the timer stops, and energy restoration will not start again until it drops below the maximum level.
You can increase the rate at which your energy is restored for a short time by using talismans (Spinning Top, Thunder Amulet, Fire Crystal). You can order these talismans from merchants, buy them at the Store for rubies, or get them as a reward for completing stages of various events and combining certain collections.
You can also use special energy boosters (Coffee a la Vienne, Waffles, Cake, etc.) to get a certain number of energy points instantly.
Note: you get free energy points every time you get gifts from your trophies, banish or placate creatures, trade with townspeople, or increase your rank in locations and puzzles.
Also, all of your energy is restored every time you level up.