As others have explained, you will have to go through immigration (passport/visa control) in JFK, as that is your port of entry into the US and you are not serving for a pre-clearance airport. You definitely cannot do that in BUF.
Now, considering all your flights to be in the same ticket, the usual procedure for a layover would be:
- At the origin, your bags would be tagged to your final destination (BUF)
- You would receive boarding passes for 3 flights
- On arrival in JFK:
- Get off the plane
- Go through immigration
- Retrieve your bags
- Go through customs
- Right after customs, drop your bags at the counter for connections (bags are already tagged, so you really just drop them on the belt) — at this point you are in the public area of the terminal, you can go anywhere you want
- Go to your departure terminal
- Go through security
- Go to your gate
- Board your connecting flight
Now, given the quite long overnight layover, it’s quite possible you won’t get all boarding passes at the origin (or in SIN), which means you will need to get it in JFK (though I expect you should be able to get a mobile boarding pass on your phone).
Most importantly, you will want, especially after the extremely long SIN-JFK flight, to spend the night in a real bed in a real room before your next flight.
For this, you have two options:
- you can ask them to short-check your bags to JFK only, so you can retrieve them and bring them with you to a hotel (you will retrieve them anyway, but I’m not sure what happens if they expect them to be dropped at the connection counter and you don’t, so it’s safer to ask). You will need to go to a check-in desk the next morning to drop your bags (so don’t forget to be there early enough)
- You can drop your bags for the connection and just have the required things for the night in your carry-on. Remember that there are limits on sizes and quantity for liquids, so plan accordingly for toiletries.
In other circumstances I would advise you to spend the evening in Manhattan or other interesting places before crashing for the night, but you are probably going to be extremely tired at that point.
A hotel close to the airport is probably the best option. It will usually be cheaper than in central locations, and you will spend less time travelling to/from the hotel.