Optimize Storage cannot free the storage completely. All your original media files will be uploaded to iCloud. iCloud is showing you mainly the storage taken up by the original image files.
On your Mac the Photos Library includes additional files -you will at least need the storage for the previews, thumbnails, faces thumbnails, the database files describing the albums and relations between the different versions of the photos and videos. These files are always stored locally and will remain even if the library is optimised.
For example:
- On my Mac the Photos Library has a size of 240.60 GB,
- the originals folder has a size of 182.58 GB,
- the edited versions and thumbnails, faces, albums , database files need 58GB, roughly 25% of the total size of the library.
Even with "Optimise storage" the local library may have a size of 25% of the not optimized library. YOu cannot free the storage completely, if you want to use the Photos.app and not be restricted to the web interface.
You can force Photos to optimise the library at once as much as possible, simply by deleting the local copy and then downloading the library from iCloud to a new, empty library, see:
How to force Photos for Mac to Optimise the Storage Immediately
But i would keep a full copy of the library on an external volume for emergencies. Otherwise you will be stuck and cannot work with your photos, if your internet is not working well. And it is very hard to make backups of your photos, if they are only in iCloud and not on your Mac. Your regular Time Machine backup will no longer include the optimised versions. Without making manual backups of your iCloud Photos you will not be able to recover accidentally deleted photos, that are no longer in Recently Deleted.
Properly backing up an optimised library is difficult, if you want to be able to recover an older state of the library with the faces, albums, location,s all originals, all older keywords and other metadata: How to back up an optimized iCloud Photos… - Apple Community
It is the reason why I am not using the "Optimise" feature on my main macs, only on a small portable Mac with not much storage.