The following information from Set up and use iCloud Photos - Apple Support describes how optimization is supposed to work and that photos may not be optimized until the space is needed for something else.
If you turn on Optimize Storage, iCloud Photos automatically manages the size of your library on your device. Your original photos and videos are stored in iCloud and space-saving versions are kept on your device. Your library is optimized only when you need space, starting with the photos and videos you access least. You can download the original photos and videos over Wi-Fi or cellular when you need them. You can use Optimize Storage on your iPhone, iPad, iPod touch, and Mac.
Apple doesn't currently offer cloud-only photo storage. If that is what you want, you may want to explore Google Photos or Dropbox.