We are looking to do something similar to this set up here:
We want the user to be able to pick a donation they want and then have the choice of paying in installments (meaning they choose how many months the installments should take via months)
As long as the user is able to select the amount of installments and that is saved to the entry, it can be accessed in the $entry object available in the snippet and rather than using a hardcoded number of recurring payments you use the selected number of installments stored in the $entry object. The calculations for the division of the installments would be handled via the calculations in the form.
The Stripe Add-On does not include built-in support for this as the Stripe API does not support specifying how many times the payment should be collected, however, there is a way to get it working using their webhooks system and some custom code to cancel the subscription when the specified number of payments have been collected: https://docs.gravityforms.com/cancel-stripe-subscription-payments/