not much i can add to what Emz has said -usually there is a kind of hierarchy people not involved in the funeral courtege wait outside until the hearse arrives then the funeral director invites them to go in and be seated then the chief mourners follow the coffin in and sit in the front rows -this might vary sometimes people do go in and sit down while others stay outside so be led by what other people do.After the service -again people tend to gather outside before dispersing too the funeral tea if there is one but you dont need to do so for long again when other people start to dispense too their cars follow their lead.
I know you are grieveing yourself but try and focus on being a quiet support for your son -should he need you to be, even though his role is different and he might feel he should be next too his dad the whole time he will be aware of your presence as something he can depend on not just for that day but for all the days after when the funeral is over -by suporting him you may find you become mutual supports of each other.
Your ex will have his new partner to turn too for support and she may be struggling to know how to do so but its for her to do even though you long too yourself it hurts but there is nothing you can do about that - you dont need to do anything more than affirm her presence, a smile or a nod will do - let her lead she may even suprise you and start a conversation but if she snubs you that is her problem not yours. I know its really difficult for you but from her point of view she is probably also dreading this day with two exes at the service and friends from the past she may feel just as much a fish out of water as you.
You are not responsible for your mums behaviour so even though she might annoy you try and ignore that, it is actually quite typical of several people i could name but its not likely anyone could ever justify blaming the daughter for the behaviour of her mum, she was friends with your mum in law so may also be focussed on the service rather than other people too.
we will be here for long after the funeral so dont be afraid to come back and talk through your grief we are all at some stage of this journey ourselves and do understand. There may be a hieracrchy at a funeral but there isnt one of grief itself and that is something it is difficult for people around us to understand.