I think the Magnetic force can be calculated using the equation F = MV*Gradient of B, where M is the magnetization of the magnetic material, V is its volume and Gradient of B is the region in the electromagnet where there is a gradient in the magnetic field. This equation is regularly used in experiments where the researchers try to guide a magnetic nanoparticle through a medium. You can also refer to Chapter 6 in the book on electrodynamics by D. J. Griffith's.
If the magnetic material acquires a residual magnetization from the electromagnet, then the residual field strength must be added to M the magnetization, but is usually about (1/1000) of M for typical metals. Some materials like soft iron do not acquire much residual magnetization, but other materials like hard steel do.
To calculate the force you need to know the magnetic field strength in the magnetic material. The problem is that the magnetic field strength in a magnetic material changes depending where it is in the field of the electro-magnet, and how strong the field of the electromagnet is. In special cases this can be calculated simply by hand - such as when the magnetic material is saturated, and when it is axially symmetric and on the axis of an axially symmetric electromagnet. This usually involves some approximations. For example, the approximations required to calculate the force on a soft iron disc very close to the end of a cylindrical soft iron core of a cylindrical electromagnet are fairly small, so you might be able to calculate the change in energy dE with small axial movements dZ, and so get dE/dz which is force. The first approximation would be that the field shape didn't change, but a thin slice of air of thickness dz moves from the back of the disc (where the field is smaller) to the front of the disc (where the field is larger) and a thin slice of the disc moves from the front to the back. This makes it slightly harder for the electromagnet to drive flux and results in a slight reduction in flux B for the same driving force H from the electromagnet, and so a reduction dEof the energy.in the magnetic field.