with today's oil quality and technology, there is a very slim necessity to flush a gas engine unless you are sure it's absolutely needed. if you are not sure, just use synthetic oil next time it will dissolve sludge as well but in a mild manner.
if you do decide to do it, there is a product in most auto parts stores, it's called "engine flush" or "engine restore" in a metal can. right before changing oil, pour it in and run engine for 5-10 minutes, idle only, don't drive the car. when done, drain it competely, change filter and refill oil. it's simple but powerful.