1. While you can purchase a designated noise machine, I've found that the WhiteNoise app does the trick for me. It pretty effectively drowns out everything from trash pickup to chatty neighbors and keeps my dog from leaping up to investigate every little noise as well.
2. Running a fan or air conditioner has the same effect as a machine for creating some white noise and may eliminate the need to leave windows open at night, further decreasing the noise.
3. Fabric acts as a great dampener. Investing in substantial drapes will help keep noises from carrying through windows and rugs can help by absorbing noise as well, eliminating the echo effect that can happen in a bare room.
4. If you have the flexibility, try rearranging your furniture and moving your headboard to the wall opposite the window, instead of directly beneath of it.
5. While there are some things you will have no control over sometimes you can address the underlying problem. A friend contacted the row of restaurants in her adjoining alley and successfully had them coordinate trash pickups so they were no longer happening three to four times a night and after a bit of pressure on management I had my faulty radiator repaired. If your upstairs neighbor wears heels around the apartment, mention it, as long as your broach the subject kindly it doesn't hurt to ask.