In this article, we first construct a family of optimal 2-step iterative methods for finding a single root of the nonlinear equation using the procedure of weight function. We then extend these methods for determining all roots simultaneously. Convergence analysis is presented for both cases to show that the order of convergence is 4 in case of the single-root finding method and is 6 for simultaneous determination of all distinct as well as multiple roots of a nonlinear equation. The dynamical behavior is presented to analyze the stability of fixed and critical points of the rational operator of one-point iterative methods. The computational cost, basins of attraction, efficiency, log of the residual, and numerical test examples show that the newly constructed methods are more efficient as compared with the existing methods in the literature.