It's
almost always at the end. I wish it were closer to the beginning to save everybody time and hassle.
For regular 'ol companies it's more about seeing what you want, most places will actually try and hit your desired salary so long as they can make some money on you.
For SV-style companies it's different. It feels different. When you get to that point, it's almost like the tone of the conversation becomes "now that you're really impressed with us, and we've decided that we'll let you into our exclusive club, how low can you go? We'll reward lower salaries with more options that'll probably not be worth anything by the time we hit a point where you can exercise them. It'd be even better if you could pay us for the honor of working here."