Modern, fast 2D rasterization is a really hard problem, one which I'm currently writing a long-form article on. The classic Red Book stencil trick + Loop-Blinn from 2005 is the current state of the art, I think. I'd love to do more research there.
In terms of a software rasterizer, which can often be faster, it's just a matter of elbow grease and engineering. Use SIMD. Implement tons of special cases.
Write a simple polygon plotter to get you started -- just fill a triangle with white with simple edge functions. Then work your way up to arbitrary polygons. And then look into the theory behind antialiasing and such.