You can do this, but you will need the infrastructure.
You need apps that connect things and give you access from the internet
Stringify or IFTTT links your IOT gadgets together to perform complex interaction based on criteria. They both have good documentation, so read up on their docs to determine which suits your needs. I like stringify better, but it totally depends on your IOT ecosystem.
You also need a hub to link all the things
There are bunch of these out there, but if you're wanting to control your devices from apps while not in the apartment, you're going to need a hub to link everything together and give you access from the internet. Samsung's smartthings hub is a great one, but there are tons of these.
You also need a window with a servo and a Nest
I don't have a window with a servo for opening and closing, and I don't know if they exist. Probably because you'd need to figure out how to make it work with window locks and those locks are all different. This is a pretty core requirement in this project, so if you're serious about it you'll have to find one or make one. Sounds like a cool weekend project or the next new company to start.
Building a stringify flow or IFTTT
In your Nest you select the temperature based on an interval that occurs at a certain time (i.e. every morning at 10am set the temp to 70F). You want to modify this behavior, so in the stringify app you can create a rule that executes 'When the temperature reaches x' turn off the Nest (and send an email / open window) and then create the inverse 'When the temperature reaches y' turn on the Nest (and send email or close window). This rule will need to apply to heating and cooling so you may want to create duplicate rules for heating and cooling.
Sometimes at my apartment it's 10 degrees cooler outside, but when I open the window in my living room it's boiling hot because it's right in the sun. The window on my deck, however is pretty much always shaded and cool to even when the temps are equal it's a source of cooler feeling air.
Happy automating! I hope this helps.