Can a state endorse a religion or is this considered establishing a religion legally?
I take it you refer to a state as in one of the 50 United States. In which case, that would depend on what do you call “endorsing”.
A state can recognize the religions of its citizens: issue a proclamation to recognize the contributions of the Jesuit order to the field of education, give a student a scholarship which he will then use to go study at Yeshiva, support a Head Start center located in a building of the First Baptist Church, proclaim Christmas a public holiday, open the meetings of the State Assembly with an Invocation, heck, it can even require developers to zone space for Houses of Worship when laying out a subdivision.
It will run into trouble for installing Nativity scenes in the State House, posting the Ten Commandments at the courthouse, making “What Would Jesus Do” the slogan of the Ethics Committee, paying for a public employee’s Hajj, or any other activity that sends the message that the state itself is supporting any religion.
The Virginia General Assembly adopted the Virginia Statute of Religious Freedom in 1786. You can read all about it here: