This
problem is a context for systematic number work, geometrical
thinking and problem solving.

It is an excellent example of a situation where the thinking
involved in analysing one rectangle can be applied directly to
other rectangles. These transferable insights about the structure
of the problem can then be expressed as algebraic statements about
all rectangles.

As students enter, display the $20$ and $50$ diagram, asking
how many squares there are. It may be appropriate to give the
answers then ask pairs to come and explain - one to talk, and one
to write/draw/record on the board. Well laid out number work will
help with the algebra later, so the students' boardwork should
prompt more suggestions about how to record working for this
problem.

Present the problem, give students an opportunity to share
first ideas. Several approaches (working backwards, trial and
error, building up from smaller ones, systematic searching) might
be suggested, and advantages/disadvantages discussed.

Encourage students to compare results with peers, and to
resolve discrepancies by mathematical argument, rather than relying
on the teacher's spreadsheet (see below). It might be useful to
gather the results of the students as they work, to help them to
see patterns and encourage them to conjecture the results for other
rectangles.

With a group who have not moved towards algebra, a final
plenary could ask for observations about the rectangles, and
discuss how each can be expressed algebraically.

How might you organise a search for rectangles with exactly
$100$ squares?

Is what you're describing specific to this rectangle? how does
it generalise?

Prove that you have all the rectangles.

Can you find an algebraic rule for the number of squares
contained in an '$m \times m$' square? an '$m \times n$'
rectangle?

For a given area, which rectangle gives the largest total
number of squares? Can you show this in general?

If the original question didn't say $100$, what other numbers
(under $100$) would give a problem with non-trivial solutions? Is
there a pattern to these?

Set up a spreadsheet to calculate numerical solutions to these
problems.

Struggling students could shade squares on worksheets (2nd sheet ) with lots of
small copies of the rectangles. Encourage them to work
systematically, in order to observe the structure, and then make
conjectures about the numbers of the next size of square, or in the
next rectangle.

Once they, either individually or as a group, have worked out
the full counting they could be asked to do this activity: In a
pair, each guess a rectangle which might have $40$ squares. Swap
squares and each work out the total. Whose guess was closest to
$40$? Between you, can you come up with a better guess?

This spreadsheet
contains a calculator to work out the totals and also lists all of
the possibilities; you might find this helpful for checking
students' work quickly.