Like anything else it takes practice if eating and drinking regularly on the bike doesn't come naturally to you.
I used to wait till I was thirsty to drink or hungry to eat. Longer races cured me of that in a hurry. When I tuned into the way my performance dropped midway through a longer race when I failed to eat and hydrate continuously I had to change my habits.
It's so easy to get caught up in the action and forget to eat or drink until you've dug a deep hole and then it's often too late to catch up. I had to start reminding to eat and drink something every fifteen to twenty minutes whether I was hungry, thirsty or not. It might be just a couple of gel blocks followed by water or a couple of gulps of energy drink but these days I rarely go more than half an hour without feeding and hydrating if I can help it.
But like any other habit, it took conscious effort to break old patterns and establish new patterns. First you've got to decide whether you care enough to break habits, does your performance suffer late in the day or on subsequent days? Then you've got to make a decision to do something about it and that typically means incorporating the new habit into daily training even if it feels ridiculous. I almost never feel hungry half an hour into a road race when I first reach for a few shot blocks or a bit of gel but establishing that habit in every race has helped tremendously when I've done all day races or multi-day stage races, but it didn't come without conscious effort.
As others have suggested having something you actually look forward to drinking in your bottles can help. I like Hammer's Heed as an energy and electrolyte drink that's not too sweet but tastes differ. I usually start a ride with one bottle of Heed and one bottle of water to chase down food and to douse myself on really hot days.
Good luck,
-Dave