When you take a dog into the vet to be put to sleep they will inject the dog with a drug for seizures which in large doses causes the dog to go unconscious.
The dogs heart and brain functions then shut down within a few minutes and then the dog dies a peaceful death.
After the dog dies the vet will then allow you to either take the dogs body with you to bury it or you can have the dog cremated if you want too.
The vet will dispose of the dogs body for you free of charge usually but if you want the dog cremated you'll need to pay a fee.
The vet can help with the cremation and it's a good way to have your pets remains close to you if you want it done that way.
Or just take the dog home with you and bury the dogs body in your yard.