Residual bilinearization. Part 1: Theory and algorithms