grate potatoes and onion in a food processor or box grater
let drain in a colander or by squeezing out in a dish towel
cover the bottom of a large frying pan with about ¼" of olive oil (you will need to add more after you fry your first few batches) and put it over medium high heat
in a large mixing bowl, put the drained potatoes and onions and mix in the eggs, flour, and sugar
mix carefully until combined, then add the salt and pepper to taste
spoon heaps of potato mixture into the hot pan, pressing them down a bit so that they are flat (more surface area = more crispy bits)
when the edges start to turn dark brown, flip them one time...and only one time.
once browned on both sides, move to a paper towel lined baking sheet to drain
sprinkle with kosher salt if desired
enjoy!
Notes
when they come out of the frying pan, i like to sprinkle them with some coarse kosher salt. this brings out the flavor and doing it straight from the pan ensure the salt will stick.