What kind of lock is this, and how can I replace it?
If you look at the lower picture, you'll see that the missing tab served to hold the plug in its recessed (locked) position. When rotated 90 degrees it lined up with the cut-outs, letting the spring (lost, I presume?) push it out to the unlocked position.

It may also have helped retain the plug in the lock. More commonly, that's actually done by a reserved wafer, so the plug can be removed and rekeyed by cutting a modified key (or by picking). If you had a new key cut recently and the new key is a bit longer or otherwise not identical, you may have unintentionally engaged that function.

If you contact the window's manufacturer -- or the lock's manufacturer if it's an aftermarket addition -- they may be able to send you a new plug with instructions for installing it. If you give them the key number they can probably issue one that responds to the same key. If you can't find a brandname, a locksmith may be able to take measurements and track it down.

Note, however, that the lock cylinder is not required to operate the latch, only to make it tamper-resistant. So you could leave it as it is, or just shove the plug back into the lock and operate it as a manual bolt rather than one that automatically pops out when you turn the key. Not as secure as it was originally,  but more so than leaving the cylinder out.