Assuming you have a 4-wide river as in the image, you'll need (this can all be bought on embark):
A carpenter
A mechanic
An architect
A mason if using stone in anything other than the mechanisms
25/26/27 logs for:
* 1/2/3 for:
** Mechanic's workshop; can be replaced with stone and/or torn down when no longer needed
** Carpenter's workshop; can be replaced with stone and/or torn down when no longer needed
** (Optional) Mason's workshop; can be replaced with stone and/or torn down when no longer needed
* 8 for a floor where the pumps go so you can build them; can be replaced with stone
* 12 for:
** 4 pipe sections
** 4 enormous corkscrews
** 4 wooden blocks; can be replaced with stone
* 3 for the waterwheel
* 1 for the east-west horizontal axle
2 stone for mechanisms
If you are replacing the blocks, take another log/stone for a mason's workshop. You can reduce the total logs needed to 22 if you tear down the carpenter's/mechanic's workshop to use its materials for the other, and this still holds true if you replace things with stone versions and build a mason's workshop at some point.
To build the contraption, place the right gear, the horizontal axle, and the floor. Don't span the floor over the whole river but instead make it 1 less than needed to go over the whole thing, otherwise the dwarves will take a swim. Once most of the floor has been completed place its last tiles, and also make the waterwheel if the right gear has been built yet. The pumps (pumping so the passable tile is closer to the waterfall) can be added in as each tile for them is added. Once everything else has been completed, build the left gear to start the whole thing going. ‼Science‼! You should now have a dammed river!
The whole setup will generate 100 power and requires 62. It doesn't have to be that exact distance from the edge of the fall and can be made farther or closer if you want, as well as mirrored vertically if the dwarves are south of the river and/or horizontally if the waterfall is in the east, or rotated... basically it's not stuck like how you see it. It can be used to dam up to a 7-tile river with basic addition of pumps; you just need 5 logs for each tile of the river. For a 8 or wider river, you'll need another water wheel. That should be extrapolatable from the image and the knowledge that a water wheel generates 100 and needs 10, and that the gear assembly/axle portion needs 12 power. You should also bring extra flooring tiles if the river is wider than 7 tiles so you can build the farther-out water wheels. I can answer any questions for wide rivers.
This can also be modified for use with a brook. You won't need the logs to build the floor for the pumps, and you'll need to channel out the area for the water wheel, but otherwise it's pretty much identical. The horizontal axle can also actually be just one tile and the waterwheel touching the top pump, but it's one power of difference and the power generator-transfer part would still not have enough juice left over to handle 8 pumps because power is only transferable from the middle tile of a water wheel.