Couldn't they use the all spark piece sam had to revive Optimus Prime
They had a piece of the all spark which revived Megatron in an earlier scene but they don't use the one Sam has, and use it on Jetfire a cranky old Decepticons who helps none of the human characters out.
I'll let you decide why they don't use the piece to revive Optimus Prime.